import repository from arizona
[raven.git] / apps / kong / initscripts / kong
1 #!/bin/sh
2 #
3 # kong      Starts kong
4 #
5 # chkconfig: 2345 96 36
6 # description: Starts and stops kong
7 #
8 ### BEGIN INIT INFO
9 # Provides: $kong
10
11 # Source function library.
12 . /etc/init.d/functions
13
14 [ -f /usr/local/bin/kong.py ] || exit 0
15
16
17 start() {
18         echo -n $"Starting kong: "
19         daemon /usr/local/bin/kong.py
20         RETVAL=$?
21         echo
22         return $RETVAL
23 }
24
25 stop() {
26         echo -n $"Shutting down kong: "
27         killproc kong
28         RETVAL=$?
29         echo ""
30         #return $RETVAL
31         return 0
32 }
33
34 restart() {
35         stop
36         start
37 }
38
39 hup() {
40         pgrep -f "python.*kong*" > /dev/null
41         if [ "$?" -eq 0 ]; then
42                 echo -n $"Restarting kong: "
43                 pkill -HUP -f "python.*kong*" > /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 $?