mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Improve ejabberdctl parameters parsing
This commit is contained in:
parent
92003fa4dc
commit
3201f8e513
@ -31,25 +31,22 @@ if [ "$EXEC_CMD" = "false" ] ; then
|
|||||||
exit 7
|
exit 7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set backward compatibility on command line parameters
|
|
||||||
set -- $(echo "$*" | sed -e \
|
|
||||||
"s/--node/-n/;s/--spool/-s/;s/--logs/-l/;\
|
|
||||||
s/--config/-f/;s/--ctl-config/-c/;s/--config-dir/-d/;\
|
|
||||||
s/--no-timeout/-t/")
|
|
||||||
# parse command line parameters
|
# parse command line parameters
|
||||||
while getopts n:s:l:f:c:d:tx opt; do
|
ARGS=`getopt -o n:s:l:f:c:d:t --long node:,spool:,logs:,config:,ctl-config:,config-dir:,no-timeout -n ejabberdctl -- "$@"`
|
||||||
case $opt in
|
eval set -- "$ARGS";
|
||||||
n) ERLANG_NODE_ARG=$OPTARG;;
|
for arg; do
|
||||||
s) SPOOL_DIR=$OPTARG;;
|
case $1 in
|
||||||
l) LOGS_DIR=$OPTARG;;
|
-n|--node) ERLANG_NODE_ARG=$2; shift;;
|
||||||
f) EJABBERD_CONFIG_PATH=$OPTARG;;
|
-s|--spool) SPOOL_DIR=$2; shift;;
|
||||||
c) EJABBERDCTL_CONFIG_PATH=$OPTARG;;
|
-l|--logs) LOGS_DIR=$2; shift;;
|
||||||
d) ETC_DIR=$OPTARG;;
|
-f|--config) EJABBERD_CONFIG_PATH=$2; shift;;
|
||||||
t) NO_TIMEOUT="--no-timeout";;
|
-c|--ctl-config) EJABBERDCTL_CONFIG_PATH=$2; shift;;
|
||||||
|
-d|--config-dir) ETC_DIR=$2; shift;;
|
||||||
|
-t|--no-timeout) NO_TIMEOUT="--no-timeout";;
|
||||||
|
--) shift; break;;
|
||||||
esac
|
esac
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
# keep extra command line parameters for ejabberd
|
|
||||||
shift $((OPTIND-1))
|
|
||||||
|
|
||||||
# define ejabberd variables if not already defined from the command line
|
# define ejabberd variables if not already defined from the command line
|
||||||
: ${ETC_DIR:={{sysconfdir}}/ejabberd}
|
: ${ETC_DIR:={{sysconfdir}}/ejabberd}
|
||||||
|
Loading…
Reference in New Issue
Block a user