updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / bitlbee-otr / bitlbee.rcd
blobeec57c8d8dd7ae50f5476a974366887a3cfc0e3e
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 /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