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