]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-search-engine
ocaml 3.09 transition
[helm.git] / helm / scripts / init.d / helm-search-engine
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 { start | stop | restart }"
11
12 if [ -f /etc/default/helm ]; then
13   . /etc/default/helm
14 fi
15
16 NAME=`basename $DAEMON`
17 PIDFILE=/var/run/$NAME.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 "."
25   echo -n "Starting $DAEMON respawner"
26   /etc/init.d/daemon_respawner.sh -p $PIDFILE \ -m root@localhost \
27     -r http://localhost:58085/help -d `basename $0` &
28   echo "."
29 }
30
31 do_stop () {
32   echo -n "Stopping $DAEMON respawner"
33   /etc/init.d/daemon_respawner.sh -d `basename $0` -s
34   echo "."
35   echo -n "Stopping $DAEMON"
36   start-stop-daemon --stop --pidfile $PIDFILE && \
37   (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi)
38   echo "."
39 }
40
41 case "$1" in
42
43   start)
44     do_start
45     ;;
46
47   stop)
48     do_stop
49     ;;
50
51   restart)
52     do_stop
53     do_start
54     ;;
55
56   *)
57     echo "$USAGE" >&2
58     exit 1
59     ;;
60
61 esac
62