17 |
|
|
18 |
. /etc/rc.d/init.d/functions |
. /etc/rc.d/init.d/functions |
19 |
|
|
20 |
node=`hostname | cut -d. -f1` |
if [ -r /etc/sysconfig/ejabberd ]; then |
21 |
|
. /etc/sysconfig/ejabberd |
22 |
|
fi |
23 |
|
|
24 |
|
if [ ! "$CONFIG_FILE" ]; then |
25 |
|
CONFIG_FILE=/etc/ejabberd/ejabberd.cfg |
26 |
|
fi |
27 |
|
|
28 |
|
node=`hostname -s` |
29 |
|
|
30 |
start() { |
start() { |
31 |
echo -n $"Starting ejabberd: " |
echo -n $"Starting ejabberd: " |
32 |
|
if [ "$ULIMIT_MAX_FILES" ]; then |
33 |
|
ulimit -n $ULIMIT_MAX_FILES |
34 |
|
fi |
35 |
daemon --user=ejabberd --check=ejabberd \ |
daemon --user=ejabberd --check=ejabberd \ |
36 |
"erl" "-pa @libdir@/ejabberd-@version@/ebin \ |
"erl" "-pa @libdir@/ejabberd/ebin \ |
37 |
-sname ejabberd \ |
-sname ejabberd \ |
38 |
-s ejabberd \ |
-s ejabberd \ |
39 |
-ejabberd config \\\"/etc/ejabberd/ejabberd.cfg\\\" \ |
-ejabberd config \\\"$CONFIG_FILE\\\" \ |
40 |
log_path \\\"/var/log/ejabberd/ejabberd.log\\\" \ |
log_path \\\"/var/log/ejabberd/ejabberd.log\\\" \ |
41 |
-sasl sasl_error_logger \\{file,\\\"/var/log/ejabberd/sasl.log\\\"\\} \ |
-sasl sasl_error_logger \\{file,\\\"/var/log/ejabberd/sasl.log\\\"\\} \ |
42 |
-mnesia dir \\\"/var/lib/ejabberd/spool\\\" \ |
-mnesia dir \\\"/var/lib/ejabberd/spool\\\" \ |
51 |
stop() { |
stop() { |
52 |
# Stop daemons. |
# Stop daemons. |
53 |
echo -n "Shutting down ejabberd: " |
echo -n "Shutting down ejabberd: " |
54 |
/sbin/runuser -s /bin/bash - ejabberd -c "erl -pa @libdir@/ejabberd-@version@/ebin -noinput -sname ejabberdctl -s ejabberd_ctl -extra ejabberd@$node stop" && success || failure |
/sbin/runuser -s /bin/bash - ejabberd -c "erl -pa @libdir@/ejabberd/ebin -noinput -sname ejabberdctl -s ejabberd_ctl -extra ejabberd@$node stop" && success || failure |
55 |
RETVAL=$? |
RETVAL=$? |
56 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ejabberd |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ejabberd |
57 |
echo |
echo |
85 |
[ -f /var/lock/subsys/ejabberd ] && restart || : |
[ -f /var/lock/subsys/ejabberd ] && restart || : |
86 |
;; |
;; |
87 |
status) |
status) |
88 |
/sbin/runuser -s /bin/bash - ejabberd -c "erl -pa @libdir@/ejabberd-@version@/ebin -noinput -sname ejabberdctl -s ejabberd_ctl -extra ejabberd@$node status" |
/sbin/runuser -s /bin/bash - ejabberd -c "erl -pa @libdir@/ejabberd/ebin -noinput -sname ejabberdctl -s ejabberd_ctl -extra ejabberd@$node status" |
89 |
;; |
;; |
90 |
*) |
*) |
91 |
echo "Usage: ejabberd {start|stop|restart|force-reload|condrestart|try-restart|status}" |
echo "Usage: ejabberd {start|stop|restart|force-reload|condrestart|try-restart|status}" |