process parameters

This commit is contained in:
Asif Bacchus 2019-05-23 21:06:49 -06:00
parent fabea27ffd
commit 44e2b93377

View File

@ -60,7 +60,7 @@ logFile="$scriptPath/${scriptName%.*}.log"
# borg output verbosity -- normal # borg output verbosity -- normal
borgCreateParams='--stats' borgCreateParams='--stats'
borgPruneParams='--list' borgPruneParams='--list'
detailsFile="$scriptPath/seafbackup.details" configDetails="$scriptPath/seafbackup.details"
# 503 related # 503 related
err503Path="$scriptPath/503_backup.html" err503Path="$scriptPath/503_backup.html"
@ -76,6 +76,96 @@ seafDir="/opt/seafile"
seafData="/var/seafile" seafData="/var/seafile"
### process startup parameters
while [ $# -gt 0 ]; do
case "$1" in
-h|-\?|--help)
# display help
scriptHelp
exit 0
;;
-l|--log)
# set log file location
if [ -n "$2" ]; then
logFile="${2%/}"
shift
else
badParam "$@"
fi
;;
-v|--verbose)
# set verbose logging from borg
borgCreateParams='--list --stats'
borgPruneParams='--list'
;;
-c|--config|--details)
# location of config details file
if [ -n "$2" ]; then
configDetails="${2%/}"
shift
else
badParam "$@"
fi
;;
-5|--503)
# FULL path to 503 file
if [ -n "$2" ]; then
err503Path="${2%/}"
err503File="${2##*/}"
shift
else
badParam "$@"
fi
;;
-w|--webroot)
# path to webroot (copy 503)
if [ -n "$2" ]; then
webroot="${2%/}"
shift
else
badParam "$@"
fi
;;
-p|--seaf|--seafdir)
# path to seafile program directory
if [ -n "$2" ]; then
seafDir="${2%/}"
shift
else
badParam "$@"
fi
;;
-d|--data|--datadir|--seafdata)
# path to seafile data directory
if [ -n "$2" ]; then
seafData="${2%/}"
shift
else
badParam "$@"
fi
;;
-o|--offline)
# shutdown seafile during backup
offlineBackup=1
;;
-u|--user|--seafuser)
# name of seafile system user
if [ -n "$2" ]; then
seafUser="${2%/}"
shift
else
badParam "$@"
fi
;;
*)
printf "${err}\nUnknown option: %s\n" "$1"
printf "${cyan}Use '--help' for valid options.{$norm}\n\n"
exit 1
;;
esac
shift
done
### start logging ### start logging
printf "${mag}[%s] --- Start %s execution ---${norm}\n" \ printf "${mag}[%s] --- Start %s execution ---${norm}\n" \