Prevent error when there are no Mongo backups to remove yet.

This commit is contained in:
2018-02-22 10:01:59 +01:00
parent f7e5db2174
commit 29d1d02bfd

View File

@@ -22,6 +22,7 @@ cd $BACKUPDIR
tar -Jcf $ARCHIVE dump-$DATE/
rm -rf dump-$DATE
rm -v $(ls $BACKUPDIR/mongo-live-*.tar.xz | head -n -7)
TO_DELETE="$(ls $BACKUPDIR/mongo-live-*.tar.xz | head -n -7)"
[ -z "$TO_DELETE" ] || rm -v $TO_DELETE
rsync -4 -va $BACKUPDIR/mongo-live-*.tar.xz cloud-backup@swami-direct.blender.cloud:/data/cloud-backup/