diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 4c08963..f0c59ff 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -1,3 +1,19 @@ { - "bookmarks": [] + "bookmarks": [ + { + "fsPath": "$ROOTPATH$/pilerBackup/pilerbackup.sh", + "bookmarks": [ + -1, + 328, + 408, + -1, + -1, + -1, + -1, + -1, + -1, + 645 + ] + } + ] } \ No newline at end of file diff --git a/pilerBackup/pilerbackup.sh b/pilerBackup/pilerbackup.sh old mode 100644 new mode 100755 index bb89a20..55c7c66 --- a/pilerBackup/pilerbackup.sh +++ b/pilerBackup/pilerbackup.sh @@ -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