a063e9c406703ded3d8512a1c3b92ee12c465139
[openpandora.oe.git] / recipes / pandora-system / pandora-libpnd / rc.pndevmapperd
1 #!/bin/sh
2
3 ### BEGIN INIT INFO
4 # Provides:          pndevmapperd
5 # Required-Start:    udev
6 # Required-Stop:     #adjust
7 # Default-Start:     2 3 4 5
8 # Default-Stop:      0 1 6
9 ### END INIT INFO
10  
11 PNDEVMAPPER='/usr/bin/pndevmapperd' #adjust
12
13 DESC="Pandora PND Event Deamon"
14 NAME="pndevmapperd"
15
16 d_stop() {
17         PID=`pidof -o %PPID -x pndevmapperd`
18         if [ $PID ]
19         then
20                 kill $PID
21         else
22                 echo "$DESC: $NAME not running."
23         fi
24 }
25
26 d_start() {
27         PID=`pidof -o %PPID -x pndevmapperd`
28         if [ $PID ]
29         then
30                 echo "$DESC: $NAME already running."
31         else
32                 $PNDEVMAPPER -d
33         fi
34 }
35
36 d_reload() {
37         PID=`pidof -o %PPID -x pndevmapperd`
38         if [ $PID ]
39         then
40                 kill -HUP $PID
41         else
42                 echo "$DESC: $NAME not running."
43         fi
44 }
45
46 case "$1" in
47   start)
48         echo "Starting $DESC: $NAME"
49         d_start &
50         ;;
51   stop)
52         echo "Stopping $DESC: $NAME"
53         d_stop
54         ;;
55   reload)
56         echo "Reloading $DESC: $NAME"
57         d_reload
58         ;;      
59   restart|force-reload)
60         echo "Restarting $DESC: $NAME"
61         d_stop
62         sleep 1
63         d_start
64         ;;
65   *)
66         echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
67         exit 1
68         ;;
69 esac
70
71 exit 0