Commit b04341ef authored by Alain Takoudjou's avatar Alain Takoudjou

gitlab-backup: remove tmp backup folder and backup.locked when script exit

When script exit, remove tmp backup folder which are not longuer needed. Keep this folder when backup is failing will contribute to fill the disk of server.
backup.locked is also removed, because we want to automatically retry gitlab-backup if previous backup failed, without human action. If the file is not removed automatically, backup is blocked until someone remove it.
parent 9791c04e
......@@ -391,6 +391,14 @@ fi
UMASK=`umask`
umask 0077 # XXX maybe not good - e.g. git-data/repositories should (?) be rwxrwx---
function cleanup {
# Cleanup temp files when script exit
rm -rf "$tmpd"
# prevent blocking gitlab-backup
lockfile=`pwd`refs/backup.locked
rm -rf $lockfile
}
trap cleanup EXIT
usage() {
echo "Usage: gitlab-backup [pull (-keep) | restore (-vupok, -go) <commit-ish>]"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment