updated on Thu Jan 19 12:17:07 UTC 2012
[aur-mirror.git] / restund / restund.sh
blob09ac4f7b3b844be114b1c5b7a350160e2c48a5bb
1 #!/bin/bash
3 daemon_name=restund
5 . /etc/rc.conf
6 . /etc/rc.d/functions
7 . /etc/conf.d/$daemon_name
9 PID=$(pidof -o %PPID /usr/sbin/$daemon_name)
10 case "$1" in
11 start)
12 stat_busy "Starting $daemon_name"
13 [ -z "$PID" ] && /usr/sbin/$daemon_name "$RESTUND_ARGS" &> /dev/null
14 if [ $? -gt 0 ]; then
15 stat_fail
16 exit 1
17 else
18 add_daemon $daemon_name
19 stat_done
22 stop)
23 stat_busy "Stopping $daemon_name"
24 [ ! -z "$PID" ] && kill $PID &> /dev/null
25 if [ $? -gt 0 ]; then
26 stat_fail
27 exit 1
28 else
29 rm_daemon $daemon_name
30 stat_done
33 restart)
34 $0 stop
35 sleep 1
36 $0 start
38 status)
39 stat_busy "Checking $daemon_name status";
40 ck_status $daemon_name
43 echo "usage: $0 {start|stop|restart|status}"
44 esac
45 exit 0