check: details exist and borg installed

This commit is contained in:
Asif Bacchus 2019-05-24 21:03:36 -06:00
parent 5df96bf69d
commit 658a8c0605

View File

@ -247,6 +247,18 @@ while [ $# -gt 0 ]; do
done done
### check pre-requisites and default values
# does the details file exist?
if [ ! -f "$configDetails" ]; then
badParam dne "(-c default)" "$configDetails"
fi
# is borg installed?
command -v borg > /dev/null || \
printf "\n${err}ERROR: BORG is not installed on this system!${norm}\n\n"
exit 3
### start logging ### start logging
printf "${mag}[%s] --- Start %s execution ---${norm}\n" \ printf "${mag}[%s] --- Start %s execution ---${norm}\n" \
"$(stamp)" "$scriptName" >> "$logFile" "$(stamp)" "$scriptName" >> "$logFile"
@ -268,6 +280,7 @@ exit 0
### error codes ### error codes
# 1: parameter error # 1: parameter error
# 2: not run as root # 2: not run as root
# 3: borg not installed
# 100: could not start seafile service # 100: could not start seafile service
# 101: could not start seahub service # 101: could not start seahub service
# 102: could not stop seafile service # 102: could not stop seafile service