updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / bitlbee-openssl / bitlbee.rcd
blob9597b4ab9351265430a3abf5119a0e4f86944eb3
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'
13 PID=$(get_pid)
14 if [ -z "$PID" ]; then
15 [ -f /var/run/bitlbee/bitlbee.pid ] && rm -f /var/run/bitlbee/bitlbee.pid
16 su -s /bin/sh -c '/usr/sbin/bitlbee -F' 'bitlbee'
17 if [ $? -gt 0 ]; then
18 stat_fail
19 exit 1
20 else
21 add_daemon bitlbee
22 stat_done
24 else
25 stat_fail
26 exit 1
30 stop)
31 stat_busy 'Stopping Bitlbee'
32 PID=$(get_pid)
33 # KILL
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/bitlbee/bitlbee.pid &> /dev/null
40 rm_daemon bitlbee
41 stat_done
45 restart)
46 $0 stop
47 sleep 3
48 $0 start
52 echo "usage: $0 {start|stop|restart}"
53 esac
54 exit 0