test for pilerexport and use found full path

This commit is contained in:
Asif Bacchus 2019-07-26 02:29:05 -06:00
parent 5dff2a6919
commit ebc77e8137
2 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,19 @@
{
"bookmarks": []
"bookmarks": [
{
"fsPath": "$ROOTPATH$/pilerBackup/pilerbackup.sh",
"bookmarks": [
-1,
328,
408,
-1,
-1,
-1,
-1,
-1,
-1,
645
]
}
]
}

11
pilerBackup/pilerbackup.sh Normal file → Executable file
View File

@ -322,6 +322,12 @@ done
### check pre-requisites and default values
# 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 +410,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 +643,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