1 |
--- src/ejabberdctl.template.fix_user 2008-08-27 13:37:52.000000000 +0400 |
2 |
+++ src/ejabberdctl.template 2008-10-02 09:24:52.000000000 +0400 |
3 |
@@ -9,13 +9,14 @@ |
4 |
|
5 |
# define default environment variables |
6 |
NODE=ejabberd |
7 |
-HOST=localhost |
8 |
+HOST=`hostname -s` |
9 |
ERLANG_NODE=$NODE@$HOST |
10 |
ERL=@erl@ |
11 |
-ROOTDIR=@rootdir@ |
12 |
+ROOTDIR= |
13 |
+MAINDIR= |
14 |
EJABBERD_CONFIG_PATH=$ROOTDIR/etc/ejabberd/ejabberd.cfg |
15 |
LOGS_DIR=$ROOTDIR/var/log/ejabberd/ |
16 |
-EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/db/$NODE |
17 |
+EJABBERD_DB=$ROOTDIR/var/lib/ejabberd/spool |
18 |
|
19 |
# read custom configuration |
20 |
CONFIG=$ROOTDIR/etc/ejabberd/ejabberdctl.cfg |
21 |
@@ -43,10 +44,10 @@ |
22 |
ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES" |
23 |
|
24 |
# define additional environment variables |
25 |
-EJABBERD_EBIN=$ROOTDIR/var/lib/ejabberd/ebin |
26 |
-EJABBERD_MSGS_PATH=$ROOTDIR/var/lib/ejabberd/priv/msgs |
27 |
-EJABBERD_SO_PATH=$ROOTDIR/var/lib/ejabberd/priv/lib |
28 |
-EJABBERD_BIN_PATH=$ROOTDIR/var/lib/ejabberd/priv/bin |
29 |
+EJABBERD_EBIN=$MAINDIR/ebin |
30 |
+EJABBERD_MSGS_PATH=$MAINDIR/priv/msgs |
31 |
+EJABBERD_SO_PATH=$MAINDIR/priv/lib |
32 |
+EJABBERD_BIN_PATH=$MAINDIR/priv/bin |
33 |
EJABBERD_LOG_PATH=$LOGS_DIR/ejabberd.log |
34 |
SASL_LOG_PATH=$LOGS_DIR/sasl.log |
35 |
DATETIME=`date "+%Y%m%d-%H%M%S"` |
36 |
@@ -139,11 +140,13 @@ |
37 |
# common control function |
38 |
ctl () |
39 |
{ |
40 |
- $ERL \ |
41 |
+ ERL_COMMAND="$ERL \ |
42 |
$NAME ejabberdctl \ |
43 |
-noinput \ |
44 |
-pa $EJABBERD_EBIN \ |
45 |
- -s ejabberd_ctl -extra $ERLANG_NODE $@ |
46 |
+ -s ejabberd_ctl -extra $ERLANG_NODE $@ \ |
47 |
+ " |
48 |
+ /sbin/runuser -s /bin/bash - ejabberd -c "$ERL_COMMAND" |
49 |
result=$? |
50 |
case $result in |
51 |
0) :;; |