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
28
echo "OK"
29
fi
30
31
32
33
34
;;
35
36
stop)
37
echo -n "Stopping $PROGRAM_NAME: "
38
39
40
41
42
43
kill -10 $PID
44
45
rm $PIDFILE
46
47
echo "No $PROGRAM_NAME found running; no killed."
48
49
50
51
restart)
52
$0 stop
53
sleep 1
54
$0 start
55
56
57
*)
58
log_success_msg "Usage: $0 {stop|start|restart}"
59
exit 1
60
61
esac