From 3a26ab4b219c7006da3ff9cdbfbd1c991e6117cf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 15 Dec 2008 11:40:12 +0000 Subject: [PATCH] * Scripts for starting / stopping Hydra. --- src/Hydra/script/hydra_control.sh | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 src/Hydra/script/hydra_control.sh diff --git a/src/Hydra/script/hydra_control.sh b/src/Hydra/script/hydra_control.sh new file mode 100755 index 00000000..2ce8b9f2 --- /dev/null +++ b/src/Hydra/script/hydra_control.sh @@ -0,0 +1,42 @@ +#! /bin/sh + +action="$1" + +if test -z "$HYDRA_DATA"; then + echo "Error: \$HYDRA_DATA is not set"; + exit 1 +fi + +if test "$action" = "start"; then + + hydra_server.pl > $HYDRA_DATA/server.log 2>&1 & + echo $! > $HYDRA_DATA/server.pid + + hydra_scheduler.pl > $HYDRA_DATA/scheduler.log 2>&1 & + echo $! > $HYDRA_DATA/scheduler.pid + + hydra_queue_runner.pl > $HYDRA_DATA/queue_runner.log 2>&1 & + echo $! > $HYDRA_DATA/queue_runner.pid + +elif test "$action" = "stop"; then + + kill $(cat $HYDRA_DATA/server.pid) + kill $(cat $HYDRA_DATA/scheduler.pid) + kill $(cat $HYDRA_DATA/queue_runner.pid) + +elif test "$action" = "status"; then + + echo -n "Hydra web server... " + (kill -0 $(cat $HYDRA_DATA/server.pid) 2> /dev/null && echo "ok") || echo "not running" + + echo -n "Hydra scheduler... " + (kill -0 $(cat $HYDRA_DATA/scheduler.pid) 2> /dev/null && echo "ok") || echo "not running" + + echo -n "Hydra queue runner... " + (kill -0 $(cat $HYDRA_DATA/queue_runner.pid) 2> /dev/null && echo "ok") || echo "not running" + + +else + echo "Syntax: $0 [start|stop|status]" + exit 1 +fi