]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-search-engine_mowgli
use new daemon_respawner.sh
[helm.git] / helm / scripts / init.d / helm-search-engine_mowgli
1 #!/bin/sh
2 #
3 # init.d script for HELM searchEngine
4 #
5 # by --Zack <zack@cs.unibo.it>
6 # Created: Fri, 22 Nov 2002 15:51:25 +0100
7 # Last-Modified: Thu,  6 Mar 2003 17:40:16 +0100
8
9 DAEMON="/projects/helm/daemons/searchEngine/searchEngine.opt"
10 USAGE="Usage: /etc/init.d/helm-search-engine_mowgli { start | stop | restart }"
11
12 if [ -f /etc/default/helm_mowgli ]; then
13   . /etc/default/helm_mowgli
14 fi
15
16 NAME=`basename $DAEMON`
17 PIDFILE=/var/run/"$NAME"_mowgli.pid
18
19 do_start () {
20   echo -n "Starting $DAEMON ... "
21   start-stop-daemon \
22     --start --pidfile $PIDFILE --make-pidfile \
23     --chuid $OWNER --background --exec $DAEMON
24   echo "done!"
25 }
26
27 do_stop () {
28   echo -n "Stopping $DAEMON ... "
29   start-stop-daemon --stop --pidfile $PIDFILE && \
30   (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi)
31   echo "done!"
32 }
33
34 case "$1" in
35
36   start)
37     do_start
38     ;;
39
40   stop)
41     do_stop
42     ;;
43
44   restart)
45     do_stop
46     do_start
47     ;;
48
49   *)
50     echo "$USAGE" >&2
51     exit 1
52     ;;
53
54 esac
55