2007-05-21 05:41:13 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
NODE=ejabberd
|
|
|
|
HOST=localhost
|
|
|
|
|
|
|
|
# Define ejabberd environment
|
2007-09-27 14:32:05 +02:00
|
|
|
ROOTDIR=@rootdir@
|
2007-05-21 05:41:13 +02:00
|
|
|
SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
|
|
|
|
EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
|
2007-09-27 14:32:05 +02:00
|
|
|
EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin
|
2007-05-21 05:41:13 +02:00
|
|
|
export EJABBERD_LOG_PATH=$ROOTDIR/var/log/ejabberd/ejabberd.log
|
|
|
|
export EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg
|
|
|
|
export EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs
|
|
|
|
export EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib
|
|
|
|
export ERL_MAX_PORTS=32000
|
|
|
|
|
|
|
|
[ -d $EJABBERD_DB ] || mkdir -p $EJABBERD_DB
|
|
|
|
|
|
|
|
function start
|
|
|
|
{
|
|
|
|
erl \
|
|
|
|
-noinput -detached \
|
|
|
|
-sname $NODE@$HOST \
|
2007-09-27 14:32:05 +02:00
|
|
|
-pa $EJABBERD_EBIN \
|
2007-05-21 05:41:13 +02:00
|
|
|
-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 \
|
2007-09-27 14:32:05 +02:00
|
|
|
-pa $EJABBERD_EBIN \
|
2007-05-21 05:41:13 +02:00
|
|
|
-mnesia dir "\"$EJABBERD_DB\"" \
|
|
|
|
-remsh $NODE@$HOST
|
|
|
|
}
|
|
|
|
|
|
|
|
function ctl
|
|
|
|
{
|
|
|
|
erl \
|
|
|
|
-noinput \
|
|
|
|
-sname ejabberdctl@$HOST \
|
2007-09-27 14:32:05 +02:00
|
|
|
-pa $EJABBERD_EBIN \
|
2007-05-21 05:41:13 +02:00
|
|
|
-s ejabberd_ctl -extra $NODE@$HOST $@
|
|
|
|
}
|
|
|
|
|
|
|
|
function usage
|
|
|
|
{
|
|
|
|
ctl
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
[ $# -lt 1 ] && usage
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start) start;;
|
|
|
|
debug) debug;;
|
|
|
|
*) ctl $@;;
|
|
|
|
esac
|
|
|
|
|