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
This commit is contained in:
Asif Bacchus 2021-05-15 09:59:42 -06:00
parent f87a2356a5
commit a4221ae6e4

View File

@ -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 tmp directory and change to it for export operations
# create temporary directory to dump exported email from piler # 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" exitError 111 "Could not create temporary directory for exported EML files"
fi fi
# grant pilerUser permission to write to temporary directory # grant pilerUser permission to write to temporary directory
@ -693,4 +694,4 @@ exit 0
# 130: null configuration variable in details file # 130: null configuration variable in details file
# 131: invalid configuration variable in details file # 131: invalid configuration variable in details file
# 138: borg exited with a critical error # 138: borg exited with a critical error
# 139: borg prune exited with a critical error # 139: borg prune exited with a critical error