summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Mazet <philippe.mazet@nxp.com>2019-11-21 15:44:09 +0100
committerPhilippe Mazet <philippe.mazet@nxp.com>2019-12-06 18:04:32 +0100
commit9783987dcc1b2b4935ea9c5d4ff7db443f0f7abe (patch)
treea40bd2138dd803545d8334cd028fe0927b523550
parent87eff59f943ed44cc9d568602ed9e2756088398c (diff)
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.
-rwxr-xr-xbackup.sh3
1 files changed, 2 insertions, 1 deletions
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 $?