1 | #!/sbin/runscript |
---|
2 | # Copyright 1999-2007 Gentoo Foundation |
---|
3 | # Distributed under the terms of the GNU General Public License v2 |
---|
4 | # $Header: /var/cvsroot/gentoo-x86/net-im/ejabberd/files/ejabberd-2.0.0.initd,v 1.1 2008/02/05 13:27:45 caleb Exp $ |
---|
5 | |
---|
6 | opts="${opts} reload" |
---|
7 | |
---|
8 | depend() { |
---|
9 | use dns |
---|
10 | need net |
---|
11 | provide jabber-server |
---|
12 | } |
---|
13 | |
---|
14 | checkconfig() { |
---|
15 | if [ ! -e /etc/jabber/ejabberd.cfg ] ; then |
---|
16 | eerror "You need an /etc/jabber/ejabberd.cfg file to run ejabberd" |
---|
17 | return 1 |
---|
18 | fi |
---|
19 | } |
---|
20 | |
---|
21 | start() { |
---|
22 | checkconfig || return 1 |
---|
23 | ebegin "Starting eJabberd" |
---|
24 | start-stop-daemon --start --quiet --chuid jabber:jabber \ |
---|
25 | --exec /usr/bin/env HOME=/var/run/jabber /usr/bin/ejabberd -- -noshell -detached |
---|
26 | eend $? |
---|
27 | # For bug #190266 |
---|
28 | chown jabber:jabber /var/run/jabber/.erlang.cookie |
---|
29 | } |
---|
30 | |
---|
31 | stop() { |
---|
32 | ebegin "Stopping eJabberd" |
---|
33 | if [ -z "$EJABBERD_NODE" ]; |
---|
34 | then |
---|
35 | EJABBERD_NODE="ejabberd@`hostname -s`" |
---|
36 | fi |
---|
37 | /usr/bin/ejabberdctl $EJABBERD_NODE stop |
---|
38 | eend $? |
---|
39 | } |
---|
40 | |
---|
41 | # Work around a bug in /sbin/runscript.sh - it won't run our custom |
---|
42 | # restart() unless it finds these two strings in the file. |
---|
43 | # svc_start svc_stop |
---|
44 | restart() { |
---|
45 | ebegin "Restarting eJabberd" |
---|
46 | if [ -z "$EJABBERD_NODE" ]; |
---|
47 | then |
---|
48 | EJABBERD_NODE="ejabberd@`hostname -s`" |
---|
49 | fi |
---|
50 | /usr/bin/ejabberdctl $EJABBERD_NODE restart |
---|
51 | eend $? |
---|
52 | } |
---|
53 | |
---|
54 | reload() { |
---|
55 | ebegin "Reloading eJabberd" |
---|
56 | if [ -z "$EJABBERD_NODE" ]; |
---|
57 | then |
---|
58 | EJABBERD_NODE="ejabberd@`hostname -s`" |
---|
59 | fi |
---|
60 | /usr/bin/ejabberdctl $EJABBERD_NODE reopen-log |
---|
61 | eend $? |
---|
62 | } |
---|