#!/bin/sh PROGRAM_NAME=GMS PROGRAM_BIN=/usr/bin/gms.py PIDFILE=/var/run/gms.pid LOGFILE=/var/log/gms.log test -x $PROGRAM_BIN || exit 0 set -e . /lib/lsb/init-functions . /etc/default/rcS case $1 in start) echo -n "Starting $PROGRAM_NAME: " if [ -f $PIDFILE ] then PID=`cat $PIDFILE` if ps ax | grep -q "^$PID" then echo "$PROGRAM_NAME already running." else rm -f $PIDFILE $PROGRAM_BIN -d > $LOGFILE echo "OK" fi else $PROGRAM_BIN -d > $LOGFILE echo "OK" fi ;; stop) echo -n "Stopping $PROGRAM_NAME: " if [ -f $PIDFILE ] then PID=`cat $PIDFILE` if ps ax | grep -q "^$PID" then kill -10 $PID fi rm $PIDFILE else echo "No $PROGRAM_NAME found running; no killed." fi ;; restart) $0 stop sleep 1 $0 start ;; *) log_success_msg "Usage: $0 {stop|start|restart}" exit 1 ;; esac