aboutsummaryrefslogtreecommitdiff
path: root/ejabberdctl.template
diff options
context:
space:
mode:
Diffstat (limited to 'ejabberdctl.template')
-rwxr-xr-xejabberdctl.template47
1 files changed, 28 insertions, 19 deletions
diff --git a/ejabberdctl.template b/ejabberdctl.template
index 79d47f83a..3b3461bbd 100755
--- a/ejabberdctl.template
+++ b/ejabberdctl.template
@@ -16,9 +16,6 @@ IEX={{bindir}}/iex
EPMD={{bindir}}/epmd
INSTALLUSER={{installuser}}
-# Compatibility in ZSH
-#setopt shwordsplit 2>/dev/null
-
# check the proper system user is used if defined
if [ "$INSTALLUSER" != "" ] ; then
EXEC_CMD="false"
@@ -140,17 +137,17 @@ if [ "$EJABBERD_CONFIG_PATH" != "${EJABBERD_CONFIG_PATH%.yml}" ] ; then
rate=$(sed '/^[ ]*log_rate_limit/!d;s/.*://;s/ *//' $EJABBERD_CONFIG_PATH)
rotate=$(sed '/^[ ]*log_rotate_size/!d;s/.*://;s/ *//' $EJABBERD_CONFIG_PATH)
count=$(sed '/^[ ]*log_rotate_count/!d;s/.*://;s/ *//' $EJABBERD_CONFIG_PATH)
- date=$(sed '/^[ ]*log_rotate_date/!d;s/.*://;s/ *//;s/""/[]/' $EJABBERD_CONFIG_PATH)
+ date=$(sed '/^[ ]*log_rotate_date/!d;s/.*://;s/ *//' $EJABBERD_CONFIG_PATH)
else
rate=$(sed '/^[ ]*log_rate_limit/!d;s/.*,//;s/ *//;s/}\.//' $EJABBERD_CONFIG_PATH)
rotate=$(sed '/^[ ]*log_rotate_size/!d;s/.*,//;s/ *//;s/}\.//' $EJABBERD_CONFIG_PATH)
count=$(sed '/^[ ]*log_rotate_count/!d;s/.*,//;s/ *//;s/}\.//' $EJABBERD_CONFIG_PATH)
- date=$(sed '/^[ ]*log_rotate_date/!d;s/.*,//;s/ *//;s/""/[]/;s/}\.//' $EJABBERD_CONFIG_PATH)
+ date=$(sed '/^[ ]*log_rotate_date/!d;s/.*,//;s/ *//;s/}\.//' $EJABBERD_CONFIG_PATH)
fi
[ -z "$rate" ] || EJABBERD_OPTS="log_rate_limit $rate"
[ -z "$rotate" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_size $rotate"
[ -z "$count" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_count $count"
-[ -z "$date" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_date $date"
+[ -z "$date" ] || EJABBERD_OPTS="${EJABBERD_OPTS} log_rotate_date '$date'"
[ -z "$EJABBERD_OPTS" ] || EJABBERD_OPTS="-ejabberd ${EJABBERD_OPTS}"
[ -d $SPOOL_DIR ] || $EXEC_CMD "mkdir -p $SPOOL_DIR"
@@ -241,14 +238,6 @@ iexlive()
--erl \"$ERLANG_OPTS\" --erl $ARGS --erl \"$@\""
}
-etop()
-{
- $EXEC_CMD "$ERL \
- $NAME debug-${TTY}-${ERLANG_NODE} \
- -hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
-}
-
-# TODO: refactor debug warning and livewarning
debugwarning()
{
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
@@ -270,7 +259,7 @@ debugwarning()
echo "Press return to continue"
read foo
echo ""
- fi
+ fi
}
livewarning()
@@ -297,7 +286,26 @@ livewarning()
fi
}
-# TODO: Make iex command display only if ejabberd Elixir support has been enabled
+etop()
+{
+ TTY=`tty | sed -e 's/.*\///g'`
+ $EXEC_CMD "$ERL \
+ $NAME debug-${TTY}-${ERLANG_NODE} \
+ -hidden -s etop -s erlang halt -output text -node $ERLANG_NODE"
+}
+
+ping()
+{
+ TTY=`tty | sed -e 's/.*\///g'`
+ $EXEC_CMD "$ERL \
+ $NAME ping-${TTY}-${ERLANG_NODE} \
+ -hidden \
+ -pa $EJABBERD_EBIN_PATH \
+ $KERNEL_OPTS $ERLANG_OPTS \
+ -eval 'io:format(\"~p~n\",[net_adm:ping($1)])' \
+ -s erlang halt -output text -noinput"
+}
+
help()
{
echo ""
@@ -328,9 +336,9 @@ ctl()
# flock that can lock a file descriptor.
MAXCONNID=100
CONNLOCKDIR={{localstatedir}}/lock/ejabberdctl
- FLOCK='/usr/bin/flock'
+ FLOCK=/usr/bin/flock
if [ ! -x "$FLOCK" ] || [ ! -d "$CONNLOCKDIR" ] ; then
- JOT='/usr/bin/jot'
+ JOT=/usr/bin/jot
if [ ! -x "$JOT" ] ; then
# no flock or jot, simply invoke ctlexec()
CTL_CONN="ctl-${ERLANG_NODE}"
@@ -410,7 +418,7 @@ ctlexec()
# stop epmd if there is no other running node
stop_epmd()
{
- $EPMD -names 2>/dev/null | grep -q name || epmd -kill >/dev/null
+ $EPMD -names 2>/dev/null | grep -q name || $EPMD -kill >/dev/null
}
# make sure node not already running and node name unregistered
@@ -470,6 +478,7 @@ case $ARGS in
' iexdebug') iexdebug;;
' live') live;;
' iexlive') iexlive;;
+ ' ping'*) ping ${ARGS# ping};;
' etop') etop;;
' started') wait_for_status 0 30 2;; # wait 30x2s before timeout
' stopped') wait_for_status 3 15 2 && stop_epmd;; # wait 15x2s before timeout