2016-11-21 15:25:58 +01:00
|
|
|
#!/bin/sh
|
2007-05-21 05:41:13 +02:00
|
|
|
|
2008-01-01 11:53:05 +01:00
|
|
|
# define default configuration
|
|
|
|
POLL=true
|
|
|
|
SMP=auto
|
|
|
|
ERL_MAX_PORTS=32000
|
|
|
|
ERL_PROCESSES=250000
|
|
|
|
ERL_MAX_ETS_TABLES=1400
|
2013-06-18 15:56:28 +02:00
|
|
|
FIREWALL_WINDOW=""
|
2017-09-27 15:04:57 +02:00
|
|
|
INET_DIST_INTERFACE=""
|
2013-06-18 15:56:28 +02:00
|
|
|
ERLANG_NODE=ejabberd@localhost
|
2013-04-08 11:12:54 +02:00
|
|
|
|
2008-01-01 11:53:05 +01:00
|
|
|
# define default environment variables
|
2017-11-06 21:35:44 +01:00
|
|
|
SCRIPT_DIR=$(cd "${0%/*}" && pwd)
|
2017-06-28 11:39:05 +02:00
|
|
|
ERL="{{erl}}"
|
|
|
|
IEX="{{bindir}}/iex"
|
|
|
|
EPMD="{{epmd}}"
|
2017-07-20 14:40:50 +02:00
|
|
|
INSTALLUSER="{{installuser}}"
|
2007-05-21 05:41:13 +02:00
|
|
|
|
2017-07-20 14:40:50 +02:00
|
|
|
# check the proper system user is used
|
2017-09-27 15:04:57 +02:00
|
|
|
case $(id -un) in
|
2017-07-20 14:40:50 +02:00
|
|
|
"$INSTALLUSER")
|
2016-11-21 15:25:58 +01:00
|
|
|
EXEC_CMD="as_current_user"
|
2017-07-20 14:40:50 +02:00
|
|
|
;;
|
|
|
|
root)
|
|
|
|
if [ -n "$INSTALLUSER" ] ; then
|
|
|
|
EXEC_CMD="as_install_user"
|
|
|
|
else
|
|
|
|
EXEC_CMD="as_current_user"
|
2018-01-21 14:44:30 +01:00
|
|
|
echo "WARNING: It is not recommended to run ejabberd as root" >&2
|
2017-07-20 14:40:50 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -n "$INSTALLUSER" ] ; then
|
|
|
|
echo "ERROR: This command can only be run by root or the user $INSTALLUSER" >&2
|
|
|
|
exit 7
|
|
|
|
else
|
|
|
|
EXEC_CMD="as_current_user"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2013-06-18 15:56:28 +02:00
|
|
|
|
2008-01-01 11:53:05 +01:00
|
|
|
# parse command line parameters
|
2018-04-24 23:30:35 +02:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-n|--node) ERLANG_NODE_ARG=$2; shift 2;;
|
|
|
|
-s|--spool) SPOOL_DIR=$2; shift 2;;
|
|
|
|
-l|--logs) LOGS_DIR=$2; shift 2;;
|
|
|
|
-f|--config) EJABBERD_CONFIG_PATH=$2; shift 2;;
|
|
|
|
-c|--ctl-config) EJABBERDCTL_CONFIG_PATH=$2; shift 2;;
|
|
|
|
-d|--config-dir) ETC_DIR=$2; shift 2;;
|
|
|
|
-t|--no-timeout) NO_TIMEOUT="--no-timeout"; shift;;
|
2017-06-01 12:10:06 +02:00
|
|
|
*) break;;
|
2008-01-01 11:53:05 +01:00
|
|
|
esac
|
|
|
|
done
|
2007-05-21 05:41:13 +02:00
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# define ejabberd variables if not already defined from the command line
|
2017-09-27 15:04:57 +02:00
|
|
|
: "${ETC_DIR:="{{sysconfdir}}/ejabberd"}"
|
|
|
|
: "${LOGS_DIR:="{{localstatedir}}/log/ejabberd"}"
|
|
|
|
: "${SPOOL_DIR:="{{localstatedir}}/lib/ejabberd"}"
|
|
|
|
: "${EJABBERD_CONFIG_PATH:="$ETC_DIR/ejabberd.yml"}"
|
|
|
|
: "${EJABBERDCTL_CONFIG_PATH:="$ETC_DIR/ejabberdctl.cfg"}"
|
2020-07-29 17:35:26 +02:00
|
|
|
# Allows passing extra Erlang command-line arguments in vm.args file
|
|
|
|
: "${VMARGS:="$ETC_DIR/vm.args"}"
|
2017-05-31 18:11:45 +02:00
|
|
|
[ -f "$EJABBERDCTL_CONFIG_PATH" ] && . "$EJABBERDCTL_CONFIG_PATH"
|
2017-09-27 15:04:57 +02:00
|
|
|
[ -n "$ERLANG_NODE_ARG" ] && ERLANG_NODE="$ERLANG_NODE_ARG"
|
2017-06-01 08:04:11 +02:00
|
|
|
[ "$ERLANG_NODE" = "${ERLANG_NODE%.*}" ] && S="-s"
|
2017-09-27 15:04:57 +02:00
|
|
|
: "${EJABBERD_DOC_PATH:="{{docdir}}"}"
|
|
|
|
: "${EJABBERD_LOG_PATH:="$LOGS_DIR/ejabberd.log"}"
|
2008-07-13 21:10:01 +02:00
|
|
|
|
2013-06-18 15:56:28 +02:00
|
|
|
# define erl parameters
|
|
|
|
ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL_OPTIONS"
|
2017-09-27 15:04:57 +02:00
|
|
|
if [ -n "$FIREWALL_WINDOW" ] ; then
|
2017-08-08 19:09:55 +02:00
|
|
|
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_listen_min ${FIREWALL_WINDOW%-*} inet_dist_listen_max ${FIREWALL_WINDOW#*-}"
|
2013-06-18 15:56:28 +02:00
|
|
|
fi
|
2017-09-27 15:04:57 +02:00
|
|
|
if [ -n "$INET_DIST_INTERFACE" ] ; then
|
2017-05-31 18:11:45 +02:00
|
|
|
INET_DIST_INTERFACE2=$("$ERL" -noshell -eval 'case inet:parse_address("'$INET_DIST_INTERFACE'") of {ok,IP} -> io:format("~p",[IP]); _ -> ok end.' -s erlang halt)
|
2017-09-27 15:04:57 +02:00
|
|
|
if [ -n "$INET_DIST_INTERFACE2" ] ; then
|
2017-07-15 13:12:47 +02:00
|
|
|
ERLANG_OPTS="$ERLANG_OPTS -kernel inet_dist_use_interface $INET_DIST_INTERFACE2"
|
2013-06-18 19:35:55 +02:00
|
|
|
fi
|
2013-06-18 15:56:28 +02:00
|
|
|
fi
|
2020-07-29 17:35:26 +02:00
|
|
|
# if vm.args file exists in config directory, pass it to Erlang VM
|
|
|
|
[ -f "$VMARGS" ] && ERLANG_OPTS="$ERLANG_OPTS -args_file $VMARGS"
|
2017-05-31 18:11:45 +02:00
|
|
|
ERL_LIBS={{libdir}}
|
|
|
|
ERL_CRASH_DUMP="$LOGS_DIR"/erl_crash_$(date "+%Y%m%d-%H%M%S").dump
|
|
|
|
ERL_INETRC="$ETC_DIR"/inetrc
|
2007-10-17 04:33:19 +02:00
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# define ejabberd parameters
|
2017-06-01 08:04:11 +02:00
|
|
|
EJABBERD_OPTS="$EJABBERD_OPTS\
|
2021-01-13 11:47:51 +01:00
|
|
|
$(sed '/^log_rotate_size/!d;s/:[ \t]*\([0-9]\{1,\}\).*/ \1/;s/:[ \t]*\(infinity\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")\
|
2020-09-22 13:50:11 +02:00
|
|
|
$(sed '/^log_rotate_count/!d;s/:[ \t]*\([0-9]*\).*/ \1/;s/^/ /' "$EJABBERD_CONFIG_PATH")"
|
2017-06-01 08:04:11 +02:00
|
|
|
[ -n "$EJABBERD_OPTS" ] && EJABBERD_OPTS="-ejabberd $EJABBERD_OPTS"
|
2017-05-31 18:11:45 +02:00
|
|
|
EJABBERD_OPTS="-mnesia dir \"$SPOOL_DIR\" $MNESIA_OPTIONS $EJABBERD_OPTS -s ejabberd"
|
2010-03-18 12:57:21 +01:00
|
|
|
|
2008-01-01 11:53:05 +01:00
|
|
|
# export global variables
|
|
|
|
export EJABBERD_CONFIG_PATH
|
2008-01-13 23:46:00 +01:00
|
|
|
export EJABBERD_LOG_PATH
|
2009-01-20 20:42:08 +01:00
|
|
|
export EJABBERD_DOC_PATH
|
2009-08-24 23:21:04 +02:00
|
|
|
export EJABBERD_PID_PATH
|
2008-01-13 23:46:00 +01:00
|
|
|
export ERL_CRASH_DUMP
|
2011-05-31 12:26:44 +02:00
|
|
|
export ERL_EPMD_ADDRESS
|
2008-01-13 23:46:00 +01:00
|
|
|
export ERL_INETRC
|
2008-01-01 11:53:05 +01:00
|
|
|
export ERL_MAX_PORTS
|
|
|
|
export ERL_MAX_ETS_TABLES
|
2015-03-24 16:00:56 +01:00
|
|
|
export CONTRIB_MODULES_PATH
|
2015-10-26 22:42:07 +01:00
|
|
|
export CONTRIB_MODULES_CONF_DIR
|
2015-10-15 15:08:45 +02:00
|
|
|
export ERL_LIBS
|
2007-10-17 04:33:19 +02:00
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# run command either directly or via su $INSTALLUSER
|
|
|
|
exec_cmd()
|
2015-01-29 18:43:47 +01:00
|
|
|
{
|
2017-05-31 18:11:45 +02:00
|
|
|
case $EXEC_CMD in
|
2017-12-10 18:52:22 +01:00
|
|
|
as_install_user) su -s /bin/sh -c '"$0" "$@"' "$INSTALLUSER" -- "$@" ;;
|
2017-05-31 18:11:45 +02:00
|
|
|
as_current_user) "$@" ;;
|
|
|
|
esac
|
2015-01-29 18:43:47 +01:00
|
|
|
}
|
2017-05-31 18:11:45 +02:00
|
|
|
exec_erl()
|
2015-01-29 18:43:47 +01:00
|
|
|
{
|
2017-05-31 18:11:45 +02:00
|
|
|
NODE=$1; shift
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_cmd "$ERL" ${S:--}name "$NODE" $ERLANG_OPTS "$@"
|
2015-01-29 18:43:47 +01:00
|
|
|
}
|
2017-05-31 18:11:45 +02:00
|
|
|
exec_iex()
|
2015-10-29 19:39:21 +01:00
|
|
|
{
|
2017-05-31 18:11:45 +02:00
|
|
|
NODE=$1; shift
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_cmd "$IEX" -${S:--}name "$NODE" --erl "$ERLANG_OPTS" "$@"
|
2015-10-29 19:39:21 +01:00
|
|
|
}
|
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# usage
|
2015-01-29 18:43:47 +01:00
|
|
|
debugwarning()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
2020-08-24 06:42:45 +02:00
|
|
|
if [ "$OSTYPE" != "cygwin" ] && [ "$OSTYPE" != "win32" ] ; then
|
|
|
|
if [ "a$TERM" = "a" ] || [ "$TERM" = "dumb" ] ; then
|
|
|
|
echo "Terminal type not supported."
|
|
|
|
echo "You may have to set the TERM environment variable to fix this."
|
|
|
|
exit 8
|
|
|
|
fi
|
2020-07-30 10:33:38 +02:00
|
|
|
fi
|
|
|
|
|
2009-12-11 20:42:59 +01:00
|
|
|
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
|
2014-07-11 12:34:52 +02:00
|
|
|
echo "--------------------------------------------------------------------"
|
|
|
|
echo ""
|
|
|
|
echo "IMPORTANT: we will attempt to attach an INTERACTIVE shell"
|
|
|
|
echo "to an already running ejabberd node."
|
|
|
|
echo "If an ERROR is printed, it means the connection was not successful."
|
|
|
|
echo "You can interact with the ejabberd node if you know how to use it."
|
|
|
|
echo "Please be extremely cautious with your actions,"
|
|
|
|
echo "and exit immediately if you are not completely sure."
|
|
|
|
echo ""
|
|
|
|
echo "To detach this shell from ejabberd, press:"
|
|
|
|
echo " control+c, control+c"
|
|
|
|
echo ""
|
|
|
|
echo "--------------------------------------------------------------------"
|
2014-07-21 15:25:16 +02:00
|
|
|
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
|
2014-07-11 12:34:52 +02:00
|
|
|
echo " EJABBERD_BYPASS_WARNINGS=true"
|
2015-01-29 18:43:47 +01:00
|
|
|
echo "Press return to continue"
|
2017-11-07 21:23:48 +01:00
|
|
|
read -r input
|
2014-07-21 15:25:16 +02:00
|
|
|
echo ""
|
2015-05-22 17:28:40 +02:00
|
|
|
fi
|
2007-10-17 04:33:19 +02:00
|
|
|
}
|
|
|
|
|
2015-01-29 18:43:47 +01:00
|
|
|
livewarning()
|
2007-10-17 04:33:19 +02:00
|
|
|
{
|
2009-12-11 20:42:59 +01:00
|
|
|
if [ "$EJABBERD_BYPASS_WARNINGS" != "true" ] ; then
|
2014-07-11 12:34:52 +02:00
|
|
|
echo "--------------------------------------------------------------------"
|
|
|
|
echo ""
|
|
|
|
echo "IMPORTANT: ejabberd is going to start in LIVE (interactive) mode."
|
|
|
|
echo "All log messages will be shown in the command shell."
|
|
|
|
echo "You can interact with the ejabberd node if you know how to use it."
|
|
|
|
echo "Please be extremely cautious with your actions,"
|
|
|
|
echo "and exit immediately if you are not completely sure."
|
|
|
|
echo ""
|
|
|
|
echo "To exit this LIVE mode and stop ejabberd, press:"
|
|
|
|
echo " q(). and press the Enter key"
|
|
|
|
echo ""
|
|
|
|
echo "--------------------------------------------------------------------"
|
2014-07-21 15:25:16 +02:00
|
|
|
echo "To bypass permanently this warning, add to ejabberdctl.cfg the line:"
|
2014-07-11 12:34:52 +02:00
|
|
|
echo " EJABBERD_BYPASS_WARNINGS=true"
|
2015-01-29 18:43:47 +01:00
|
|
|
echo "Press return to continue"
|
2017-11-07 21:23:48 +01:00
|
|
|
read -r input
|
2014-07-21 15:25:16 +02:00
|
|
|
echo ""
|
2009-12-11 20:42:59 +01:00
|
|
|
fi
|
2013-06-18 15:56:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
help()
|
2008-10-12 14:00:20 +02:00
|
|
|
{
|
|
|
|
echo ""
|
|
|
|
echo "Commands to start an ejabberd node:"
|
2015-10-29 19:39:21 +01:00
|
|
|
echo " start Start an ejabberd node in server mode"
|
|
|
|
echo " debug Attach an interactive Erlang shell to a running ejabberd node"
|
|
|
|
echo " iexdebug Attach an interactive Elixir shell to a running ejabberd node"
|
|
|
|
echo " live Start an ejabberd node in live (interactive) mode"
|
|
|
|
echo " iexlive Start an ejabberd node in live (interactive) mode, within an Elixir shell"
|
|
|
|
echo " foreground Start an ejabberd node in server mode (attached)"
|
2008-10-12 14:00:20 +02:00
|
|
|
echo ""
|
|
|
|
echo "Optional parameters when starting an ejabberd node:"
|
2014-07-21 15:25:16 +02:00
|
|
|
echo " --config-dir dir Config ejabberd: $ETC_DIR"
|
2008-10-12 14:00:20 +02:00
|
|
|
echo " --config file Config ejabberd: $EJABBERD_CONFIG_PATH"
|
|
|
|
echo " --ctl-config file Config ejabberdctl: $EJABBERDCTL_CONFIG_PATH"
|
|
|
|
echo " --logs dir Directory for logs: $LOGS_DIR"
|
2014-07-21 15:25:16 +02:00
|
|
|
echo " --spool dir Database spool dir: $SPOOL_DIR"
|
2008-10-12 14:00:20 +02:00
|
|
|
echo " --node nodename ejabberd node name: $ERLANG_NODE"
|
|
|
|
echo ""
|
|
|
|
}
|
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# dynamic node name helper
|
2016-04-21 12:00:51 +02:00
|
|
|
uid()
|
2010-01-24 14:39:15 +01:00
|
|
|
{
|
2016-04-21 12:00:51 +02:00
|
|
|
uuid=$(uuidgen 2>/dev/null)
|
2017-09-27 15:04:57 +02:00
|
|
|
[ -z "$uuid" ] && [ -f /proc/sys/kernel/random/uuid ] && uuid=$(cat /proc/sys/kernel/random/uuid)
|
|
|
|
[ -z "$uuid" ] && uuid=$(printf "%X" "${RANDOM:-$$}$(date +%M%S)")
|
2020-04-03 17:28:27 +02:00
|
|
|
uuid=$(printf '%s' $uuid | sed 's/^\(...\).*$/\1/')
|
2017-09-27 15:04:57 +02:00
|
|
|
[ $# -eq 0 ] && echo "${uuid}-${ERLANG_NODE}"
|
|
|
|
[ $# -eq 1 ] && echo "${uuid}-${1}-${ERLANG_NODE}"
|
|
|
|
[ $# -eq 2 ] && echo "${uuid}-${1}@${2}"
|
2010-01-24 14:39:15 +01:00
|
|
|
}
|
|
|
|
|
2013-06-18 15:56:28 +02:00
|
|
|
# stop epmd if there is no other running node
|
|
|
|
stop_epmd()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
2016-04-25 14:26:04 +02:00
|
|
|
"$EPMD" -names 2>/dev/null | grep -q name || "$EPMD" -kill >/dev/null
|
2007-05-21 05:41:13 +02:00
|
|
|
}
|
|
|
|
|
2013-06-18 15:56:28 +02:00
|
|
|
# make sure node not already running and node name unregistered
|
2017-05-31 18:11:45 +02:00
|
|
|
# if all ok, ensure runtime directory exists and make it current directory
|
2013-06-18 15:56:28 +02:00
|
|
|
check_start()
|
2009-08-24 21:43:52 +02:00
|
|
|
{
|
2016-04-25 14:26:04 +02:00
|
|
|
"$EPMD" -names 2>/dev/null | grep -q " ${ERLANG_NODE%@*} " && {
|
2017-09-27 15:04:57 +02:00
|
|
|
pgrep -f "$ERLANG_NODE" >/dev/null && {
|
2013-06-18 15:56:28 +02:00
|
|
|
echo "ERROR: The ejabberd node '$ERLANG_NODE' is already running."
|
|
|
|
exit 4
|
|
|
|
}
|
2017-09-27 15:04:57 +02:00
|
|
|
pgrep beam >/dev/null && {
|
|
|
|
echo "ERROR: The ejabberd node '$ERLANG_NODE' is registered,"
|
|
|
|
echo " but no related beam process has been found."
|
|
|
|
echo "Shutdown all other erlang nodes, and call 'epmd -kill'."
|
|
|
|
exit 5
|
|
|
|
}
|
|
|
|
"$EPMD" -kill >/dev/null
|
2013-06-18 15:56:28 +02:00
|
|
|
}
|
2009-08-24 21:43:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
# allow sync calls
|
2017-05-31 18:11:45 +02:00
|
|
|
wait_status()
|
2009-08-24 21:43:52 +02:00
|
|
|
{
|
|
|
|
# args: status try delay
|
|
|
|
# return: 0 OK, 1 KO
|
2017-09-27 15:04:57 +02:00
|
|
|
timeout="$2"
|
2009-08-24 21:43:52 +02:00
|
|
|
status=4
|
2017-09-27 15:04:57 +02:00
|
|
|
while [ "$status" -ne "$1" ] ; do
|
|
|
|
sleep "$3"
|
|
|
|
timeout=$((timeout - 1))
|
2017-05-31 18:11:45 +02:00
|
|
|
if [ $timeout -eq 0 ] ; then
|
2017-09-27 15:04:57 +02:00
|
|
|
status="$1"
|
2017-05-31 18:11:45 +02:00
|
|
|
else
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$(uid ctl)" -hidden -noinput -s ejabberd_ctl \
|
|
|
|
-extra "$ERLANG_NODE" $NO_TIMEOUT status > /dev/null
|
|
|
|
status="$?"
|
2017-05-31 18:11:45 +02:00
|
|
|
fi
|
2009-08-24 21:43:52 +02:00
|
|
|
done
|
2017-05-31 18:11:45 +02:00
|
|
|
[ $timeout -gt 0 ]
|
2012-06-08 17:33:21 +02:00
|
|
|
}
|
|
|
|
|
2017-07-20 14:40:50 +02:00
|
|
|
# ensure we can change current directory to SPOOL_DIR
|
|
|
|
[ -d "$SPOOL_DIR" ] || exec_cmd mkdir -p "$SPOOL_DIR"
|
|
|
|
cd "$SPOOL_DIR" || {
|
|
|
|
echo "ERROR: can not access directory $SPOOL_DIR"
|
|
|
|
exit 6
|
|
|
|
}
|
|
|
|
|
2017-05-31 18:11:45 +02:00
|
|
|
# main
|
|
|
|
case $1 in
|
|
|
|
start)
|
|
|
|
check_start
|
2018-01-29 01:16:20 +01:00
|
|
|
exec_erl "$ERLANG_NODE" $EJABBERD_OPTS -detached
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
foreground)
|
|
|
|
check_start
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$ERLANG_NODE" $EJABBERD_OPTS -noinput
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
2021-01-27 09:24:05 +01:00
|
|
|
foreground-quiet)
|
|
|
|
check_start
|
|
|
|
exec_erl "$ERLANG_NODE" $EJABBERD_OPTS -noinput -ejabberd quiet true
|
|
|
|
;;
|
2017-05-31 18:11:45 +02:00
|
|
|
live)
|
|
|
|
livewarning
|
|
|
|
check_start
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$ERLANG_NODE" $EJABBERD_OPTS
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
debug)
|
|
|
|
debugwarning
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$(uid debug)" -hidden -remsh "$ERLANG_NODE"
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
etop)
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$(uid top)" -hidden -node "$ERLANG_NODE" -s etop \
|
2017-05-31 18:11:45 +02:00
|
|
|
-s erlang halt -output text
|
|
|
|
;;
|
|
|
|
iexdebug)
|
|
|
|
debugwarning
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_iex "$(uid debug)" --remsh "$ERLANG_NODE"
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
iexlive)
|
|
|
|
livewarning
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_iex "$ERLANG_NODE" --erl "$EJABBERD_OPTS" --app ejabberd
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
ping)
|
2017-06-01 08:04:11 +02:00
|
|
|
PEER=${2:-$ERLANG_NODE}
|
|
|
|
[ "$PEER" = "${PEER%.*}" ] && PS="-s"
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_cmd "$ERL" ${PS:--}name "$(uid ping "$(hostname $PS)")" $ERLANG_OPTS \
|
2017-09-11 16:00:00 +02:00
|
|
|
-noinput -hidden -eval 'io:format("~p~n",[net_adm:ping('"'$PEER'"')])' \
|
2017-06-01 08:04:11 +02:00
|
|
|
-s erlang halt -output text
|
2017-05-31 18:11:45 +02:00
|
|
|
;;
|
|
|
|
started)
|
|
|
|
wait_status 0 30 2 # wait 30x2s before timeout
|
|
|
|
;;
|
|
|
|
stopped)
|
|
|
|
wait_status 3 30 2 && stop_epmd # wait 30x2s before timeout
|
|
|
|
;;
|
|
|
|
*)
|
2017-09-27 15:04:57 +02:00
|
|
|
exec_erl "$(uid ctl)" -hidden -noinput -s ejabberd_ctl \
|
|
|
|
-extra "$ERLANG_NODE" $NO_TIMEOUT "$@"
|
2017-05-31 18:11:45 +02:00
|
|
|
result=$?
|
|
|
|
case $result in
|
|
|
|
2|3) help;;
|
|
|
|
*) :;;
|
|
|
|
esac
|
|
|
|
exit $result
|
|
|
|
;;
|
2007-05-21 05:41:13 +02:00
|
|
|
esac
|