gmyth-stream/server/0.3/data/gmsd
author renatofilho
Tue Aug 21 20:04:23 2007 +0100 (2007-08-21)
branchtrunk
changeset 817 888b9724f601
permissions -rwxr-xr-x
[svn r823] fixed monitor_handler dispose
     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
    28             echo "OK"
    29         fi
    30     else
    31         $PROGRAM_BIN -d > $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 ax | grep -q "^$PID"
    42         then
    43             kill -10 $PID
    44         fi
    45         rm $PIDFILE
    46     else
    47         echo "No $PROGRAM_NAME found running; no killed."
    48     fi
    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