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