From 74a30ffe8255deb506ff07bd0deb8b0d93592c13 Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 13 Nov 2007 03:50:41 +0000 Subject: [PATCH] init.d style script for starting and stopping relay --- xwords4/relay/xwrelay.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 xwords4/relay/xwrelay.sh diff --git a/xwords4/relay/xwrelay.sh b/xwords4/relay/xwrelay.sh new file mode 100755 index 000000000..30c2310b1 --- /dev/null +++ b/xwords4/relay/xwrelay.sh @@ -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