gmyth-stream/server/data/gmsd
author renatofilho
Wed Jan 23 20:07:03 2008 +0000 (2008-01-23)
branchtrunk
changeset 892 e4323b3483bf
parent 832 daa61fffb811
child 914 ef147f779302
permissions -rwxr-xr-x
[svn r898] release 0.6
     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         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     ;;
    35 
    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     ;;
    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