From 9ec1d5004911a56e6853d3bff2ac5306013dfbc5 Mon Sep 17 00:00:00 2001 From: MegaBrutal Date: Thu, 20 Aug 2015 07:31:48 +0200 Subject: [PATCH] backup.sh: Clean up junk if tar creation fails If the file system gets full during tar creation, and the junk files (SQL dumps, partial TAR) stay there, the file system is left with 100% usage. This may have very unpleasant consequences, so it's best to simply remove those files. modified: mysql/backup.sh --- mysql/backup.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysql/backup.sh b/mysql/backup.sh index a68853f..5040f3f 100755 --- a/mysql/backup.sh +++ b/mysql/backup.sh @@ -49,5 +49,8 @@ then done else echo "Failed to create archive: ${tarname}." + echo "Cleaning up..." + cd ${stordir} + rm -rv ${tempdir} exit 1 fi -- 2.34.1