From: Stefano Zacchiroli Date: Wed, 9 Oct 2002 09:36:49 +0000 (+0000) Subject: added /etc/init.d/ stuff X-Git-Tag: BEFORE_METADATA_FOR_SORT_AND_REL~48 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=ab934e873165bf0e661c9e59fddf81714bcb32ff;p=helm.git added /etc/init.d/ stuff --- diff --git a/helm/scripts/init.d/etc_default_helm b/helm/scripts/init.d/etc_default_helm new file mode 100644 index 000000000..d6e841310 --- /dev/null +++ b/helm/scripts/init.d/etc_default_helm @@ -0,0 +1,18 @@ +# Configuration for helm daemons + + # DAEMONS started/stopped/ecc. by /etc/init.d/helm, name listed here + # must correspond to scripts located in /etc/init.d +DAEMONS=" + helm-http-getter + helm-proof-checker + helm-uri-set-queue + helm-draw-graph +" + + # script used to define a good(TM) environment for daemons +ENVSCRIPT="/projects/helm/shared/scripts/phd.rc" + + # user which will own the daemons +OWNER="sacerdot:helm" + +# vim: set ft=sh: diff --git a/helm/scripts/init.d/helm b/helm/scripts/init.d/helm new file mode 100755 index 000000000..c58a15d50 --- /dev/null +++ b/helm/scripts/init.d/helm @@ -0,0 +1,37 @@ +#!/bin/sh +# +# init.d script for HELM daemons +# +# by --Zack +# Created: Tue, 8 Oct 2002 17:18:17 +0200 +# Last-Modified: Tue, 8 Oct 2002 17:18:17 +0200 + +DAEMONS="" +if [ -f /etc/default/helm ]; then + . /etc/default/helm +fi + +case "$1" in + + start|stop|restart|force-reload|reload) + for d in $DAEMONS; do + /etc/init.d/$d $1 + done + ;; + + *) + echo + echo "Usage: /etc/init.d/helm { start | stop | restart | force-reload | reload }" >&2 + echo + if [ -z "$DAEMONS" ]; then + echo "Actually, no daemons are considered!" + else + echo "Actually, considered daemons are: $DAEMONS" + fi + echo "to change this setting see /etc/default/helm" + echo + exit 1 + ;; + +esac + diff --git a/helm/scripts/init.d/helm-draw-graph b/helm/scripts/init.d/helm-draw-graph new file mode 100755 index 000000000..cdb5c0538 --- /dev/null +++ b/helm/scripts/init.d/helm-draw-graph @@ -0,0 +1,59 @@ +#!/bin/sh +# +# init.d script for HELM draw_graph.cgi +# +# by --Zack +# Created: Wed, 9 Oct 2002 11:12:01 +0200 +# Last-Modified: Wed, 9 Oct 2002 11:12:01 +0200 + +DAEMON=/projects/helm/graphs/tools/draw_graph.cgi +USAGE="Usage: /etc/init.d/helm-draw-graph { start | stop | restart }" + +ENVSCRIPT="" +if [ -f /etc/default/helm ]; then + . /etc/default/helm +fi +if ! [ -f "$ENVSCRIPT" ]; then + echo "Can't find environment script '$ENVSCRIPT'" + exit 1 +fi +. $ENVSCRIPT &> /dev/null + +NAME=`basename $DAEMON` +PIDFILE=/projects/helm/run/$NAME.pid + +do_start () { + echo "Starting $DAEMON ..." + start-stop-daemon \ + --start --background --pidfile $PIDFILE --make-pidfile \ + --chuid $OWNER --exec $DAEMON +} + +do_stop () { + echo "Stopping $DAEMON ..." + start-stop-daemon --stop --pidfile $PIDFILE && \ + (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi) +} + +case "$1" in + + start) + do_start + ;; + + stop) + do_stop + ;; + + restart) + do_stop + do_start + ;; + + *) + echo "$USAGE" >&2 + exit 1 + ;; + +esac + diff --git a/helm/scripts/init.d/helm-http-getter b/helm/scripts/init.d/helm-http-getter new file mode 100755 index 000000000..87f7a5b4b --- /dev/null +++ b/helm/scripts/init.d/helm-http-getter @@ -0,0 +1,59 @@ +#!/bin/sh +# +# init.d script for http_getter.pl +# +# by --Zack +# Created: Tue, 8 Oct 2002 17:18:17 +0200 +# Last-Modified: Wed, 9 Oct 2002 11:12:01 +0200 + +DAEMON=/projects/helm/http_getter/http_getter.pl +USAGE="Usage: /etc/init.d/helm-http-getter { start | stop | restart }" + +ENVSCRIPT="" +if [ -f /etc/default/helm ]; then + . /etc/default/helm +fi +if ! [ -f "$ENVSCRIPT" ]; then + echo "Can't find environment script '$ENVSCRIPT'" + exit 1 +fi +. $ENVSCRIPT &> /dev/null + +NAME=`basename $DAEMON` +PIDFILE=/projects/helm/run/$NAME.pid + +do_start () { + echo "Starting $DAEMON ..." + start-stop-daemon \ + --start --background --pidfile $PIDFILE --make-pidfile \ + --chuid $OWNER --exec $DAEMON +} + +do_stop () { + echo "Stopping $DAEMON ..." + start-stop-daemon --stop --pidfile $PIDFILE && \ + (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi) +} + +case "$1" in + + start) + do_start + ;; + + stop) + do_stop + ;; + + restart) + do_stop + do_start + ;; + + *) + echo "$USAGE" >&2 + exit 1 + ;; + +esac + diff --git a/helm/scripts/init.d/helm-proof-checker b/helm/scripts/init.d/helm-proof-checker new file mode 100755 index 000000000..e96d10c4a --- /dev/null +++ b/helm/scripts/init.d/helm-proof-checker @@ -0,0 +1,59 @@ +#!/bin/sh +# +# init.d script for HELM proof checker +# +# by --Zack +# Created: Wed, 9 Oct 2002 11:12:01 +0200 +# Last-Modified: Wed, 9 Oct 2002 11:12:01 +0200 + +DAEMON=/projects/helm/proofChecker/proofChecker.pl +USAGE="Usage: /etc/init.d/helm-proof-checker { start | stop | restart }" + +ENVSCRIPT="" +if [ -f /etc/default/helm ]; then + . /etc/default/helm +fi +if ! [ -f "$ENVSCRIPT" ]; then + echo "Can't find environment script '$ENVSCRIPT'" + exit 1 +fi +. $ENVSCRIPT &> /dev/null + +NAME=`basename $DAEMON` +PIDFILE=/projects/helm/run/$NAME.pid + +do_start () { + echo "Starting $DAEMON ..." + start-stop-daemon \ + --start --background --pidfile $PIDFILE --make-pidfile \ + --chuid $OWNER --exec $DAEMON +} + +do_stop () { + echo "Stopping $DAEMON ..." + start-stop-daemon --stop --pidfile $PIDFILE && \ + (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi) +} + +case "$1" in + + start) + do_start + ;; + + stop) + do_stop + ;; + + restart) + do_stop + do_start + ;; + + *) + echo "$USAGE" >&2 + exit 1 + ;; + +esac + diff --git a/helm/scripts/init.d/helm-uri-set-queue b/helm/scripts/init.d/helm-uri-set-queue new file mode 100755 index 000000000..771140539 --- /dev/null +++ b/helm/scripts/init.d/helm-uri-set-queue @@ -0,0 +1,59 @@ +#!/bin/sh +# +# init.d script for HELM uri_set_queue.cgi +# +# by --Zack +# Created: Tue, 8 Oct 2002 17:18:17 +0200 +# Last-Modified: Wed, 9 Oct 2002 11:12:01 +0200 + +DAEMON=/projects/helm/graphs/tools/uri_set_queue.cgi +USAGE="Usage: /etc/init.d/helm-uri-set-queue { start | stop | restart }" + +ENVSCRIPT="" +if [ -f /etc/default/helm ]; then + . /etc/default/helm +fi +if ! [ -f "$ENVSCRIPT" ]; then + echo "Can't find environment script '$ENVSCRIPT'" + exit 1 +fi +. $ENVSCRIPT &> /dev/null + +NAME=`basename $DAEMON` +PIDFILE=/projects/helm/run/$NAME.pid + +do_start () { + echo "Starting $DAEMON ..." + start-stop-daemon \ + --start --background --pidfile $PIDFILE --make-pidfile \ + --chuid $OWNER --exec $DAEMON +} + +do_stop () { + echo "Stopping $DAEMON ..." + start-stop-daemon --stop --pidfile $PIDFILE && \ + (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi) +} + +case "$1" in + + start) + do_start + ;; + + stop) + do_stop + ;; + + restart) + do_stop + do_start + ;; + + *) + echo "$USAGE" >&2 + exit 1 + ;; + +esac +