updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / autoscan / autoscan-network
blob93deb85bf02757f34574000e57964d44d26e9b04
1 #!/bin/bash
2 PATH=/usr/sbin:/usr/bin:/sbin:/bin
3 DESC="Autoscan network"
4 DAEMON=/usr/sbin/autoscan-network-daemon
6 daemon_name=autoscan-network
8 . /etc/rc.conf
9 . /etc/rc.d/functions
10 . /etc/conf.d/$daemon_name.conf
12 get_pid() {
13 pidof -o %PPID $daemon_name
16 case "$1" in
17 start)
18 stat_busy "Starting $daemon_name daemon"
20 PID=$(get_pid)
21 if [ -z "$PID" ]; then
22 [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
23 # RUN
24 $daemon_name
26 if [ $? -gt 0 ]; then
27 stat_fail
28 exit 1
29 else
30 echo $(get_pid) > /var/run/$daemon_name.pid
31 add_daemon $daemon_name
32 stat_done
34 else
35 stat_fail
36 exit 1
40 stop)
41 stat_busy "Stopping $daemon_name daemon"
42 PID=$(get_pid)
43 # KILL
44 [ ! -z "$PID" ] && kill $PID &> /dev/null
46 if [ $? -gt 0 ]; then
47 stat_fail
48 exit 1
49 else
50 rm -f /var/run/$daemon_name.pid &> /dev/null
51 rm_daemon $daemon_name
52 stat_done
56 restart)
57 $0 stop
58 sleep 3
59 $0 start
62 status)
63 stat_busy "Checking $daemon_name status";
64 ck_status $daemon_name
68 echo "usage: $0 {start|stop|restart|status}"
69 esac
71 exit 0