updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / npd6 / npd6
blob3391bd99d013551fc3b364b2fee22c791e21e1a7
1 #!/bin/bash
3 # Author: Sean Groarke, sgroarke@gmail.com>
4 # Modifier: Justin Wong, justin.w.xd@gmail.com
5 # $HeadURL: https://npd6.googlecode.com/svn/trunk/etc/npd6 $
6 # $Id: npd6 51 2011-08-03 11:14:38Z npd6Project $
8 daemon_name=npd6
10 . /etc/rc.conf
11 . /etc/rc.d/functions
13 get_pid() {
14 pidof -o %PPID $daemon_name
17 case "$1" in
18 start)
19 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
39 stop)
40 stat_busy "Stopping $daemon_name daemon"
41 PID=$(get_pid)
42 # KILL
43 [ ! -z "$PID" ] && kill $PID &> /dev/null
45 if [ $? -gt 0 ]; then
46 stat_fail
47 exit 1
48 else
49 rm -f /var/run/$daemon_name.pid &> /dev/null
50 rm_daemon $daemon_name
51 stat_done
55 restart)
56 $0 stop
57 sleep 1
58 $0 start
61 status)
62 stat_busy "Checking $daemon_name status";
63 ck_status $daemon_name
67 echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
68 exit 3
70 esac