2004-01-11 21:42:57 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-05-21 05:41:13 +02:00
|
|
|
NODE=ejabberd
|
|
|
|
HOST=localhost
|
|
|
|
|
|
|
|
# Define ejabberd environment
|
2009-08-06 23:54:10 +02:00
|
|
|
ERL=erl
|
2008-07-11 14:48:27 +02:00
|
|
|
here=`which "$0" 2>/dev/null || echo .`
|
|
|
|
base="`dirname $here`/.."
|
2007-05-21 05:41:13 +02:00
|
|
|
ROOTDIR=`(cd "$base"; echo $PWD)`
|
2009-08-31 13:03:35 +02:00
|
|
|
SASL_LOG_PATH=$ROOTDIR/erlang.log
|
2007-05-21 05:41:13 +02:00
|
|
|
EJABBERD_DB=$ROOTDIR/database/$NODE
|
2007-09-27 14:32:05 +02:00
|
|
|
EJABBERD_EBIN=$ROOTDIR/src
|
2007-05-21 05:41:13 +02:00
|
|
|
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
|
2008-03-21 16:42:14 +01:00
|
|
|
export EJABBERD_BIN_PATH=$ROOTDIR/src
|
2007-05-21 05:41:13 +02:00
|
|
|
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
|
|
|
|
|
2009-08-06 23:54:10 +02:00
|
|
|
start()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
2009-08-06 23:54:10 +02:00
|
|
|
$ERL \
|
2007-05-21 05:41:13 +02:00
|
|
|
-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\"\}
|
|
|
|
}
|
|
|
|
|
2009-08-06 23:54:10 +02:00
|
|
|
debug()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
2009-08-06 23:54:10 +02:00
|
|
|
$ERL \
|
2007-05-21 05:41:13 +02:00
|
|
|
-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\"" \
|
2009-07-06 16:11:31 +02:00
|
|
|
-hidden \
|
2007-05-21 05:41:13 +02:00
|
|
|
-remsh $NODE@$HOST
|
|
|
|
}
|
|
|
|
|
2009-08-06 23:54:10 +02:00
|
|
|
ctl()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
2009-08-06 23:54:10 +02:00
|
|
|
$ERL \
|
|
|
|
-sname ctl$NODE@$HOST \
|
2007-09-27 14:32:05 +02:00
|
|
|
-pa $EJABBERD_EBIN \
|
2009-08-06 23:54:10 +02:00
|
|
|
-noinput \
|
2009-07-06 16:11:31 +02:00
|
|
|
-hidden \
|
2007-05-21 05:41:13 +02:00
|
|
|
-s ejabberd_ctl -extra $NODE@$HOST $@
|
|
|
|
}
|
|
|
|
|
2009-08-06 23:54:10 +02:00
|
|
|
usage()
|
2007-05-21 05:41:13 +02:00
|
|
|
{
|
|
|
|
ctl
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
[ $# -lt 1 ] && usage
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
start) start;;
|
|
|
|
debug) debug;;
|
|
|
|
*) ctl $@;;
|
|
|
|
esac
|