updated on Fri Jan 13 04:01:25 UTC 2012
[aur-mirror.git] / bitlbee-bzr / rc.d
blobbd9248173f47781d2bea1a8666b6e7aab53dc840
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 name=bitlbee
7 PID=$(pidof -o %PPID /usr/sbin/bitlbee)
8 install -o bitlbee -g bitlbee -d -m 755 /var/run/bitlbee
10 case "$1" in
11 start)
12 stat_busy "Starting $name daemon"
13 [[ -z "$PID" ]] && {
14 rm -f /var/run/bitlbee/bitlbee.pid
15 su -s /bin/sh -c '/usr/sbin/bitlbee -F' bitlbee
16 } && {
17 add_daemon $name
18 stat_done
19 } || { stat_fail; exit 1; }
21 stop)
22 stat_busy "Stopping $name daemon"
23 [[ -n "$PID" ]] && {
24 kill $PID &>/dev/null
25 } && {
26 rm -f /var/run/bitlbee/bitlbee.pid
27 rm_daemon $name
28 stat_done
29 } || { stat_fail; exit 1; }
31 restart)
32 $0 stop
33 sleep 3
34 $0 start
37 echo "usage: $0 {start|stop|restart}"
38 exit 1
40 esac