From a4221ae6e40737018739bac98359469674c1516f Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 15 May 2021 09:59:42 -0600 Subject: [PATCH] refactor(script): used fixed export location - previous random name made full restore virtually impossible - use one container directory to make full restore easy - store each backup in timestamped subdirectory for easy incremental restore --- pilerBackup/pilerbackup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pilerBackup/pilerbackup.sh b/pilerBackup/pilerbackup.sh index d0500cc..d3c2d83 100755 --- a/pilerBackup/pilerbackup.sh +++ b/pilerBackup/pilerbackup.sh @@ -421,7 +421,8 @@ printf "%s[%s] -- [INFO] %s%s%s imported --%s\n" \ ## create tmp directory and change to it for export operations # create temporary directory to dump exported email from piler -if ! exportDir=$( mktemp -d 2>>"$logFile" ); then +tmpdir="/tmp/emailbackup/$( date +%F_%T )" +if ! exportDir=$( mkdir -p "${tmpdir}" 2>>"$logFile" ); then exitError 111 "Could not create temporary directory for exported EML files" fi # grant pilerUser permission to write to temporary directory @@ -693,4 +694,4 @@ exit 0 # 130: null configuration variable in details file # 131: invalid configuration variable in details file # 138: borg exited with a critical error -# 139: borg prune exited with a critical error \ No newline at end of file +# 139: borg prune exited with a critical error