updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / bitlbee-otr-bzr / bitlbee.rcd
blobb8d6137dccf16f9a0f6cda0f66228b3fad160b19
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 get_pid() {
7 pidof -o %PPID /usr/sbin/bitlbee
10 case "$1" in
11 start)
12 stat_busy "Starting Bitlbee"
14 PID=$(get_pid)
15 if [ -z "$PID" ]; then
16 [ -f /var/run/bitlbee/bitlbee.pid ] && rm -f /var/run/bitlbee/bitlbee.pid
17 su -s /bin/sh -c "/usr/sbin/bitlbee -F" "bitlbee"
18 if [ $? -gt 0 ]; then
19 stat_fail
20 exit 1
21 else
22 add_daemon bitlbee
23 stat_done
25 else
26 stat_fail
27 exit 1
31 stop)
32 stat_busy "Stopping Bitlbee"
33 PID=$(get_pid)
34 # KILL
35 [ ! -z "$PID" ] && kill $PID &> /dev/null
36 if [ $? -gt 0 ]; then
37 stat_fail
38 exit 1
39 else
40 rm -f /var/run/bitlbee/bitlbee.pid &> /dev/null
41 rm_daemon bitlbee
42 stat_done
46 restart)
47 $0 stop
48 sleep 3
49 $0 start
52 echo "usage: $0 {start|stop|restart}"
53 esac
54 exit 0