From 9783987dcc1b2b4935ea9c5d4ff7db443f0f7abe Mon Sep 17 00:00:00 2001 From: Philippe Mazet Date: Thu, 21 Nov 2019 15:44:09 +0100 Subject: backup.sh: avoid "file changed as we read it" error In some case (long jobs), backup failed because some files were changed during tar operation. --- backup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backup.sh b/backup.sh index 33323b7..35f7d9c 100755 --- a/backup.sh +++ b/backup.sh @@ -24,7 +24,8 @@ docker exec -ti $DOCKERID gzip /tmp/db_lavaserver || exit $? docker cp $DOCKERID:/tmp/db_lavaserver.gz $BACKUP_DIR/ || exit $? docker exec -ti $DOCKERID rm /tmp/db_lavaserver.gz || exit $? -docker exec -ti $DOCKERID tar czf /root/joboutput.tar.gz /var/lib/lava-server/default/media/job-output/ || exit $? +# tar outputs warnings when file changes on disk while creating tar file. So do not "exit on error" +docker exec -ti $DOCKERID tar czf /root/joboutput.tar.gz /var/lib/lava-server/default/media/job-output/ || echo "WARNING: tar operation returned $?" docker cp $DOCKERID:/root/joboutput.tar.gz $BACKUP_DIR/ || exit $? docker exec -ti $DOCKERID rm /root/joboutput.tar.gz || exit $? -- cgit 1.2.3-korg