import repository from arizona
[raven.git] / apps / gacks / gacksnm.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/gacksnm/bin/gacksnm.py ]; then
15    echo "missing gacksnm.py"
16    exit 0
17 fi
18
19
20 start() {
21         chmod +x /usr/local/gacksnm/bin/gacksnm.py
22         echo -n $"Starting gacks node manager: "
23         #daemon /usr/local/gackscentral/bin/gacksserver.py --daemon
24         cd /usr/local/gacksnm/bin
25         python ./gacksnm.py --daemon  
26         echo
27 }
28
29 stop() {
30         echo -n $"Shutting down gacks central: "
31         killproc gacksnm
32         echo
33         return 0
34 }
35
36 restart() {
37         stop
38         start
39 }
40
41 hup() {
42         pgrep -f "python.*gacksnm" > /dev/null
43         if [ "$?" -eq 0 ]; then
44                 echo -n $"Restarting gacks nm: "
45                 pkill -HUP -f "python.*gacksnm" > /dev/null
46                 RETVAL=$?
47                 if [ "$RETVAL" -eq 0 ]; then
48                         success
49                 else
50                         failure
51                 fi
52                 echo ""
53                 return 1
54         else
55                 start
56         fi
57 }
58
59 rhstatus() {
60         echo "Sorry, not implemented..."
61 }
62
63
64 case "$1" in
65   start)
66         start
67         ;;
68   stop)
69         stop
70         ;;
71   restart|reload|condrestart)
72         restart
73         ;;
74   hup)
75         hup
76         ;;
77   status)
78         rhstatus
79         ;;
80   *)
81         echo $"Usage: $0 {start|stop|restart|reload|condrestart|hup|status}"
82         exit 1
83 esac
84
85 exit $?