updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / adsuck / adsuck.rc
blob8167c3713a2bad847499ee2d6753d1e6948fe680
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 PID=$(pidof -o %PPID /usr/sbin/adsuck)
7 PARAM="-c /var/adsuck -f /resolv.conf /hosts -r /filter"
9 case "$1" in
10 start)
11 stat_busy "Starting Adsuck Daemon"
13 if [[ -z $PID ]] && /usr/sbin/adsuck $PARAM; then
14 PID=$(pidof -o %PPID /usr/sbin/adsuck)
15 echo "$PID" > /var/run/adsuck.pid
16 add_daemon adsuck
17 stat_done
18 else
19 stat_fail
20 exit 1
23 stop)
24 stat_busy "Stopping Adsuck Daemon"
25 if [[ ! -z $PID ]] && kill "$PID" &>/dev/null; then
26 rm_daemon adsuck
27 stat_done
28 else
29 stat_fail
30 exit 1
33 reload)
34 stat_busy "Reloading configuration"
35 kill -HUP "$PID" # reload resolv.conf
36 kill -USR1 "$PID" # reload regex and hostfile
37 stat_done
39 restart)
40 $0 stop
41 $0 start
44 echo "Usage: $0 {start|stop|reload|restart}" >&2
45 exit 1
46 esac