gmyth-stream/server/0.3/data/gmsd
branchtrunk
changeset 830 0e159c5e2d32
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmyth-stream/server/0.3/data/gmsd	Wed Aug 29 10:00:25 2007 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +PROGRAM_NAME=GMS
     1.7 +PROGRAM_BIN=/usr/bin/gms.py
     1.8 +PIDFILE=/var/run/gms.pid
     1.9 +LOGFILE=/var/log/gms.log
    1.10 +
    1.11 +test -x $PROGRAM_BIN || exit 0
    1.12 +
    1.13 +set -e
    1.14 +
    1.15 +. /lib/lsb/init-functions
    1.16 +. /etc/default/rcS
    1.17 +
    1.18 +case $1 in
    1.19 +  start)
    1.20 +    echo -n "Starting $PROGRAM_NAME: "
    1.21 +    if [ -f $PIDFILE ]
    1.22 +    then
    1.23 +        PID=`cat $PIDFILE`
    1.24 +
    1.25 +        if ps ax | grep -q "^$PID"
    1.26 +        then
    1.27 +            echo "$PROGRAM_NAME already running."
    1.28 +        else
    1.29 +            rm -f $PIDFILE
    1.30 +            $PROGRAM_BIN -d > $LOGFILE
    1.31 +            echo "OK"
    1.32 +        fi
    1.33 +    else
    1.34 +        $PROGRAM_BIN -d > $LOGFILE
    1.35 +        echo "OK"
    1.36 +    fi
    1.37 +    ;;
    1.38 +
    1.39 +  stop)
    1.40 +    echo -n "Stopping $PROGRAM_NAME: "
    1.41 +    if [ -f $PIDFILE ]
    1.42 +    then
    1.43 +        PID=`cat $PIDFILE`
    1.44 +        if ps ax | grep -q "^$PID"
    1.45 +        then
    1.46 +            kill -10 $PID
    1.47 +        fi
    1.48 +        rm $PIDFILE
    1.49 +    else
    1.50 +        echo "No $PROGRAM_NAME found running; no killed."
    1.51 +    fi
    1.52 +    ;;
    1.53 +
    1.54 +  restart)
    1.55 +    $0 stop
    1.56 +    sleep 1
    1.57 +    $0 start
    1.58 +    ;;
    1.59 +
    1.60 +  *)
    1.61 +    log_success_msg "Usage: $0 {stop|start|restart}"
    1.62 +    exit 1
    1.63 +    ;;
    1.64 +esac