updated on Fri Jan 20 12:03:34 UTC 2012
[aur-mirror.git] / pyirc / pyirc.rc
blob5e5710abca1e32351f9115d8246dd9df5a9d4cd6
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 get_pid() {
7 [ -f /var/run/pyirct.pid ] && echo `cat /var/run/pyirct.pid`
10 case "$1" in
11 start)
12 stat_busy "Starting jabber IRC transport daemon"
14 [ -f /var/run/pyirct.pid ] && rm -f /var/run/pyirct.pid
15 PID=`get_pid`
16 if [ -z "$PID" ]; then
17 cd /usr/lib/pyirc && python2 ./irc.py 1>/dev/null 2>/dev/null &
18 if [ $? -gt 0 ]; then
19 stat_fail
20 exit 1
21 else
22 add_daemon pyirct
23 stat_done
25 else
26 stat_fail
27 exit 1
31 stop)
32 stat_busy "Stopping jabber IRC transport daemon"
33 PID=`get_pid`
34 [ ! -z "$PID" ] && kill $PID &> /dev/null
35 if [ $? -gt 0 ]; then
36 stat_fail
37 exit 1
38 else
39 rm -f /var/run/pyirct.pid &> /dev/null
40 rm_daemon pyirct
41 stat_done
45 restart)
46 $0 stop
47 sleep 3
48 $0 start
51 echo "usage: $0 {start|stop|restart}"
52 esac
53 exit 0