diff options
author | root <root@rshg054.dnsready.net> | 2011-08-09 23:14:31 +0000 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2011-08-09 23:14:31 +0000 |
commit | a306c2530354c1c02351c4cc02eefa53c8d23eac (patch) | |
tree | 85f473f0abb92a80a4a400a7c07eed79d83880bd /community-staging/jabberd14/jabberd | |
parent | 5135b52f901206bbb365152084e82e92c120e0be (diff) |
Tue Aug 9 23:14:31 UTC 2011
Diffstat (limited to 'community-staging/jabberd14/jabberd')
-rw-r--r-- | community-staging/jabberd14/jabberd | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/community-staging/jabberd14/jabberd b/community-staging/jabberd14/jabberd new file mode 100644 index 000000000..afbe6ef69 --- /dev/null +++ b/community-staging/jabberd14/jabberd @@ -0,0 +1,58 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +get_pid() { + pidof /usr/bin/jabberd +} + +case "$1" in + start) + stat_busy "Starting Jabber daemon" + + [ -d /var/run/jabberd ] || mkdir -p /var/run/jabberd + [ -f /var/run/jabberd/jabber.pid ] && rm -f /var/run/jabberd/jabber.pid + PID=`get_pid` + if [ -z "$PID" ]; then + /usr/bin/jabberd -c /etc/jabberd/jabber.xml -B >/dev/null 2>/dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + sleep 1 # wait on children + echo `get_pid` > /var/run/jabberd/jabberd.pid + add_daemon jabberd + sleep 1 + stat_done + fi + else + stat_fail + exit 1 + fi + ;; + + stop) + stat_busy "Stopping Jabber daemon" + PID=`get_pid` + [ ! -z "$PID" ] && kill $PID &> /dev/null + sleep 2 + if [ $? -gt 0 ]; then + stat_fail + exit 1 + else + rm -f /var/run/jabberd/jabberd.pid &> /dev/null + rm_daemon jabberd + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 |