init.d style script for starting and stopping relay

This commit is contained in:
ehouse 2007-11-13 03:50:41 +00:00
parent 4fb097369e
commit be0005667f

37
relay/xwrelay.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
XWRELAY="./xwrelay"
PIDFILE=./xwrelay.pid
case $1 in
stop)
if [ -f $PIDFILE ]; then
sync
echo "killing pid=$(cat $PIDFILE)"
kill $(cat $PIDFILE)
rm $PIDFILE
else
echo "not running"
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
start|*)
if [ -f $PIDFILE ]; then
echo "already running: pid=$(cat $PIDFILE)"
else
echo "starting..."
$XWRELAY
sleep 1
echo "running with pid=$(cat $PIDFILE)"
fi
;;
esac