Commit 6729fbfc authored by Nigel Kukard's avatar Nigel Kukard

Merge branch 'add-getopts' into 'master'

Add getopts support

See merge request !17
parents 0aa8212a 16ed4945
Pipeline #897 passed with stages
in 1 minute and 14 seconds
......@@ -21,35 +21,23 @@
case ${0##*/} in
backup-daily)
PERIOD="daily"
if [[ $1 == --verbose ]]
then
OPT="$1"
fi
;;
backup-weekly)
PERIOD="weekly"
if [[ $1 == --verbose ]]
then
OPT="$1"
fi
;;
backstep-traceback-auto)
case $1 in
daily|weekly)
PERIOD="$1"
;;
--verbose)
echo "ERROR: You need to specify - $0 <period> --verbose."
exit 1
;;
*)
echo "ERROR: $1 is not a valid option."
exit 1
;;
esac
;;
esac
# Parse options
OPTIND=1
getopts ":v" OPTION
# Remove option from parameters
shift $(expr $OPTIND - 1)
if [ -z "$PERIOD" -a -n "$1" ]
then
PERIOD="$1"
fi
if [ -e /etc/backstep-traceback/${PERIOD}.conf ]
then
source /etc/backstep-traceback/${PERIOD}.conf
......@@ -58,13 +46,8 @@ else
exit 1
fi
if [[ -n $2 ]]
then
OPT="$2"
fi
# Change opts for when we are debugging
if [[ $OPT == --verbose ]]
# Change sync options for when we are debugging
if [ "$OPTION" = "v" ]
then
syncopts="--debug --max-load=20"
set -ex
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment