summaryrefslogtreecommitdiff
path: root/community/jabberd14/jabberd
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/jabberd14/jabberd
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/jabberd14/jabberd')
-rw-r--r--community/jabberd14/jabberd58
1 files changed, 58 insertions, 0 deletions
diff --git a/community/jabberd14/jabberd b/community/jabberd14/jabberd
new file mode 100644
index 000000000..afbe6ef69
--- /dev/null
+++ b/community/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