Compare commits
2 Commits
5dff2a6919
...
e495b65b24
Author | SHA1 | Date | |
---|---|---|---|
|
e495b65b24 | ||
|
ebc77e8137 |
16
pilerBackup/pilerbackup.sh
Normal file → Executable file
16
pilerBackup/pilerbackup.sh
Normal file → Executable file
@ -322,6 +322,17 @@ done
|
||||
|
||||
|
||||
### check pre-requisites and default values
|
||||
# check if running as root, otherwise exit
|
||||
if [ $( id -u ) -ne 0 ]; then
|
||||
printf "\n${err}ERROR: script MUST be run as ROOT${norm}\n\n"
|
||||
exit 2
|
||||
fi
|
||||
# find pilerexport, otherwise this is all pointless
|
||||
pilerExport=$( command -v pilerexport )
|
||||
if [ ! "$pilerExport" ]; then
|
||||
printf "\n${err}ERROR: cannot find 'pilerexport'${norm}\n\n"
|
||||
exit 4
|
||||
fi
|
||||
# does the details file exist?
|
||||
if [ ! -f "$configDetails" ]; then
|
||||
badParam dne "(--details default)" "$configDetails"
|
||||
@ -404,13 +415,13 @@ printf "\n${yellow}%s/${cyan} --${norm}\n" "$exportDir" >> "$logFile"
|
||||
printf "${cyan}[%s] -- [INFO] Exporting EML files from piler --${norm}\n" \
|
||||
"$(stamp)" >> "$logFile"
|
||||
if [ "$exportAll" -eq 1 ]; then
|
||||
if ! pilerexport -A 2>>"$logFile"; then
|
||||
if ! ${pilerExport} -A 2>>"$logFile"; then
|
||||
exitError 115 "There was a problem while exporting EML from piler"
|
||||
fi
|
||||
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||
"$(stamp)" >> "$logFile"
|
||||
else
|
||||
if ! pilerexport -a "$exportStart" -b "$exportEnd" 2>>"$logFile"; then
|
||||
if ! ${pilerExport} -a "$exportStart" -b "$exportEnd" 2>>"$logFile"; then
|
||||
exitError 115 "There was a problem while exporting EML from piler"
|
||||
fi
|
||||
printf "${ok}[%s] -- [SUCCESS] Exported EML files from piler --${norm}\n" \
|
||||
@ -637,6 +648,7 @@ exit 0
|
||||
# 1: parameter error
|
||||
# 2: not run as root
|
||||
# 3: borg not installed
|
||||
# 4: cannot find pilerexport executable
|
||||
# 99: TERM signal trapped
|
||||
# 111: could not create tmp dir for EML dump from piler-export
|
||||
# 112: could not set permissions on tmp dir
|
||||
|
Loading…
Reference in New Issue
Block a user