tar: file changed as we read it

前端 未结 8 1995
你的背包
你的背包 2020-12-02 15:03

I am using make and tar to backup. When executing makefile, tar command shows file changed as we read it. In this case,

8条回答
  •  天涯浪人
    2020-12-02 15:54

    I am not sure does it suit you but I noticed that tar does not fail on changed/deleted files in pipe mode. See what I mean.

    Test script:

    #!/usr/bin/env bash
    set -ex
    tar cpf - ./files | aws s3 cp - s3://my-bucket/files.tar
    echo $?
    

    Deleting random files manually...

    Output:

    + aws s3 cp - s3://my-bucket/files.tar
    + tar cpf - ./files
    tar: ./files/default_images: File removed before we read it
    tar: ./files: file changed as we read it
    + echo 0
    0
    

提交回复
热议问题