]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/scripts/init.d/helm-search-engine_mowgli
snapshot
[helm.git] / helm / scripts / init.d / helm-search-engine_mowgli
diff --git a/helm/scripts/init.d/helm-search-engine_mowgli b/helm/scripts/init.d/helm-search-engine_mowgli
new file mode 100755 (executable)
index 0000000..7864db7
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# init.d script for HELM searchEngine
+#
+# by --Zack <zack@cs.unibo.it>
+# Created: Fri, 22 Nov 2002 15:51:25 +0100
+# Last-Modified: Fri, 22 Nov 2002 15:51:25 +0100
+
+DAEMON=/projects/helm/V7_mowgli/helm/searchEngine/searchEngine.opt
+USAGE="Usage: /etc/init.d/helm-search-engine_mowgli { start | stop | restart }"
+
+ENVSCRIPT=""
+if [ -f /etc/default/helm_mowgli ]; then
+  . /etc/default/helm_mowgli
+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"_mowgli.pid
+
+do_start () {
+  echo "Starting $DAEMON ..."
+  start-stop-daemon \
+    --start --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
+