1
#!/bin/sh
2
3
PROGRAM_NAME=GMS
4
PROGRAM_BIN=/usr/bin/gms.py
5
PIDFILE=/var/run/gms.pid
6
LOGFILE=/var/log/gms.log
7
8
test -x $PROGRAM_BIN || exit 0
9
10
set -e
11
12
. /lib/lsb/init-functions
13
. /etc/default/rcS
14
15
case $1 in
16
start)
17
echo -n "Starting $PROGRAM_NAME: "
18
if [ -f $PIDFILE ]
19
then
20
PID=`cat $PIDFILE`
21
22
if ps ax | grep -q "^$PID"
23
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
31
32
33
34
;;
35
36
stop)
37
echo -n "Stopping $PROGRAM_NAME: "
38
39
40
41
if ps -p "$PID" > /dev/null
42
43
kill -9 $PID
44
45
rm $PIDFILE
46
47
48
echo "No $PROGRAM_NAME found running; no killed."
49
50
51
52
restart)
53
$0 stop
54
sleep 1
55
$0 start
56
57
58
*)
59
log_success_msg "Usage: $0 {stop|start|restart}"
60
exit 1
61
62
esac