author | melunko |
Tue Sep 18 13:45:04 2007 +0100 (2007-09-18) | |
branch | trunk |
changeset 846 | 5d027884a9d3 |
parent 832 | daa61fffb811 |
child 914 | ef147f779302 |
permissions | -rwxr-xr-x |
1 #!/bin/sh
3 PROGRAM_NAME=GMS
4 PROGRAM_BIN=/usr/bin/gms.py
5 PIDFILE=/var/run/gms.pid
6 LOGFILE=/var/log/gms.log
8 test -x $PROGRAM_BIN || exit 0
10 set -e
12 . /lib/lsb/init-functions
13 . /etc/default/rcS
15 case $1 in
16 start)
17 echo -n "Starting $PROGRAM_NAME: "
18 if [ -f $PIDFILE ]
19 then
20 PID=`cat $PIDFILE`
22 if ps ax | grep -q "^$PID"
23 then
24 echo "$PROGRAM_NAME already running."
25 else
26 rm -f $PIDFILE
27 $PROGRAM_BIN -d > $LOGFILE 2> $LOGFILE
28 echo "OK"
29 fi
30 else
31 $PROGRAM_BIN -d > $LOGFILE 2> $LOGFILE
32 echo "OK"
33 fi
34 ;;
36 stop)
37 echo -n "Stopping $PROGRAM_NAME: "
38 if [ -f $PIDFILE ]
39 then
40 PID=`cat $PIDFILE`
41 if ps -p "$PID" > /dev/null
42 then
43 kill -9 $PID
44 fi
45 rm $PIDFILE
46 echo "OK"
47 else
48 echo "No $PROGRAM_NAME found running; no killed."
49 fi
50 ;;
52 restart)
53 $0 stop
54 sleep 1
55 $0 start
56 ;;
58 *)
59 log_success_msg "Usage: $0 {stop|start|restart}"
60 exit 1
61 ;;
62 esac