]> granicus.if.org Git - ejabberd/commitdiff
* src/ejabberdctl.template: Updated version of ejabberdctl (thanks
authorAlexey Shchepin <alexey@process-one.net>
Mon, 21 May 2007 03:41:13 +0000 (03:41 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Mon, 21 May 2007 03:41:13 +0000 (03:41 +0000)
to Christophe Romain)
* tools/ejabberdctl: Likewise
* src/Makefile.in: Updated

SVN Revision: 773

ChangeLog
src/Makefile.in
src/ejabberdctl.template [new file with mode: 0644]
tools/ejabberdctl

index dd9b5eb7b2f41a86088e025dffb035f84e2959c8..37d3eb8a692bba859c2b2f5eb462fa503d14a82e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-05-21  Alexey Shchepin  <alexey@sevcom.net>
 
+       * src/ejabberdctl.template: Updated version of ejabberdctl (thanks
+       to Christophe Romain)
+       * tools/ejabberdctl: Likewise
+       * src/Makefile.in: Updated
+
        * src/ejabberd_sm.erl: Updated the session table to store
        additional session info
        * src/ejabberd_c2s.erl: Report IP address to ejabberd_sm (thanks
index eb585182b443c80aa9a72940f60cd885cb8eb2cb..102999ccab8493462d8af5419d413833eb257abd 100644 (file)
@@ -90,6 +90,8 @@ install: all
        install -m 644 msgs/*.msg $(MSGSDIR)
        install -d $(ETCDIR)
        [ -f $(ETCDIR)/ejabberd.cfg ] && install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg-new || install -b -m 644 ejabberd.cfg.example $(ETCDIR)/ejabberd.cfg
+       sed -e "s*@rootdir@*@prefix@*" ejabberdctl.template > ejabberdctl.example
+       install -m 755 ejabberdctl.example $(DESTDIR)@prefix@/usr/sbin/ejabberdctl
        install -d $(LOGDIR)
 
 clean: clean-recursive clean-local
diff --git a/src/ejabberdctl.template b/src/ejabberdctl.template
new file mode 100644 (file)
index 0000000..3c77ec5
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+NODE=ejabberd
+HOST=localhost
+
+# Define ejabberd environment
+ROOTDIR=@prefix@
+SASL_LOG_PATH=$ROOTDIR/var/log/ejabberd/sasl.log
+EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE
+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 \
+      -pa $ROOTDIR/src \
+      -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 $ROOTDIR/src \
+      -mnesia dir "\"$EJABBERD_DB\"" \
+      -remsh $NODE@$HOST
+}
+
+function ctl
+{
+    erl \
+      -noinput \
+      -sname ejabberdctl@$HOST \
+      -pa $ROOTDIR/src \
+      -s ejabberd_ctl -extra $NODE@$HOST $@
+}
+
+function usage
+{
+    ctl
+    exit
+}
+
+[ $# -lt 1 ] && usage
+
+case $1 in
+    start) start;;
+    debug) debug;;
+    *) ctl $@;;
+esac
+
index 48294cae905a9c5a48977cd5d0dc2a339dc30ba3..f4e134b344f492b86edee54e958ff91a05292c5d 100755 (executable)
@@ -1,4 +1,64 @@
 #!/bin/sh
 
-exec erl -noinput -sname ejabberdctl -s ejabberd_ctl -extra $@
+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
+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 $ROOTDIR/src \
+      -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 $ROOTDIR/src \
+      -mnesia dir "\"$EJABBERD_DB\"" \
+      -remsh $NODE@$HOST
+}
+
+function ctl
+{
+    erl \
+      -noinput \
+      -sname ejabberdctl@$HOST \
+      -pa $ROOTDIR/src \
+      -s ejabberd_ctl -extra $NODE@$HOST $@
+}
+
+function usage
+{
+    ctl
+    exit
+}
+
+[ $# -lt 1 ] && usage
+
+case $1 in
+    start) start;;
+    debug) debug;;
+    *) ctl $@;;
+esac