25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00
xmpp.chapril.org-ejabberd/tools/ejabberdctl
Christophe Romain 0bb936f848 apply rootdir patch from Badlop (EJAB-385)
SVN Revision: 951
2007-09-27 12:32:05 +00:00

66 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
NODE=ejabberd
HOST=localhost
# Define ejabberd environment
base="`dirname $(which "$0")`/.."
ROOTDIR=`(cd "$base"; echo $PWD)`
SASL_LOG_PATH=$ROOTDIR/sasl.log
EJABBERD_DB=$ROOTDIR/database/$NODE
EJABBERD_EBIN=$ROOTDIR/src
export EJABBERD_LOG_PATH=$ROOTDIR/ejabberd.log
export EJABBERD_CONFIG_PATH=$ROOTDIR/ejabberd.cfg
export EJABBERD_MSGS_PATH=$ROOTDIR/src/msgs
export EJABBERD_SO_PATH=$ROOTDIR/src
export ERL_MAX_PORTS=32000
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
[ -f $EJABBERD_CONFIG_PATH ] || cp $ROOTDIR/src/ejabberd.cfg.example $EJABBERD_CONFIG_PATH
function start
{
erl \
-noinput -detached \
-sname $NODE@$HOST \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-s ejabberd \
-ejabberd config \"$EJABBERD_CONFIG_PATH\" \
log_path \"$EJABBERD_LOG_PATH\" \
-sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
}
function debug
{
erl \
-sname debug$NODE@$HOST \
-pa $EJABBERD_EBIN \
-mnesia dir "\"$EJABBERD_DB\"" \
-remsh $NODE@$HOST
}
function ctl
{
erl \
-noinput \
-sname ejabberdctl@$HOST \
-pa $EJABBERD_EBIN \
-s ejabberd_ctl -extra $NODE@$HOST $@
}
function usage
{
ctl
exit
}
[ $# -lt 1 ] && usage
case $1 in
start) start;;
debug) debug;;
*) ctl $@;;
esac