import repository from arizona
[raven.git] / apps / servicemonitor / sample / sample.init
1 #!/bin/sh
2 #
3 # gackscentral.init      Starts gacks central
4 #
5 # chkconfig: 2345 95 35
6 # description: Starts and stops gacks central
7 #
8 ### BEGIN INIT INFO
9 # Provides: $gackscentral
10
11 # Source function library.
12 . /etc/init.d/functions
13
14 if [ ! -f /usr/local/bin/sample.py ]; then
15    echo "missing sample.py"
16    exit 0
17 fi
18
19
20 start() {
21         echo -n $"Starting sample: "
22         #daemon /usr/local/gackscentral/bin/gacksserver.py --daemon
23         python /usr/local/bin/sample.py
24         echo
25 }
26
27 stop() {
28         echo -n $"Shutting down sample: "
29         pkill -f "python.*sample.py"
30         echo
31         return 0
32 }
33
34 restart() {
35         stop
36         start
37 }
38
39 hup() {
40         pgrep -f "python.*sample" > /dev/null
41         if [ "$?" -eq 0 ]; then
42                 echo -n $"Restarting sample: "
43                 pkill -HUP -f "python.*sample" > /dev/null
44                 RETVAL=$?
45                 if [ "$RETVAL" -eq 0 ]; then
46                         success
47                 else
48                         failure
49                 fi
50                 echo ""
51                 return 1
52         else
53                 start
54         fi
55 }
56
57 rhstatus() {
58         echo "Sorry, not implemented..."
59 }
60
61
62 case "$1" in
63   start)
64         start
65         ;;
66   stop)
67         stop
68         ;;
69   restart|reload|condrestart)
70         restart
71         ;;
72   hup)
73         hup
74         ;;
75   status)
76         rhstatus
77         ;;
78   *)
79         echo $"Usage: $0 {start|stop|restart|reload|condrestart|hup|status}"
80         exit 1
81 esac
82
83 exit $?