]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-uwobo
ocaml 3.09 transition
[helm.git] / helm / scripts / init.d / helm-uwobo
1 #!/bin/sh
2 #
3 # init.d script for http_getter
4 #
5 # by --Zack <zack@cs.unibo.it>
6 # Created: Wed, 15 Jan 2003 15:14:07 +0100
7 # Last-Modified: Fri, 16 Apr 2004 17:54:54 +0200
8
9 DAEMON="/projects/helm/daemons/uwobo/uwobo.opt"
10 USAGE="Usage: /etc/init.d/helm-uwobo { start | stop | restart }"
11
12 if [ -f /etc/default/helm ]; then
13   . /etc/default/helm
14 fi
15
16 NAME=`basename $DAEMON`
17 # Warning: $PIDFILE value is shared by UWOBO respawner, change at your own risk
18 PIDFILE=/var/run/$NAME.pid
19
20 do_start () {
21   echo -n "Starting $DAEMON"
22   start-stop-daemon \
23     --start --background --pidfile $PIDFILE --make-pidfile \
24     --chuid $OWNER --exec $DAEMON
25   echo "."
26   echo -n "Waiting for UWOBO to startup (2 seconds) ... "
27   sleep 2
28   echo "done!"
29   /etc/init.d/helm-uwobo-stylesheets start
30   echo -n "Starting $DAEMON respawner"
31   /etc/init.d/daemon_respawner.sh -p $PIDFILE \ -m root@localhost \
32     -r http://localhost:58080/help -d `basename $0` &
33   echo "."
34 }
35
36 do_stop () {
37   echo -n "Stopping $DAEMON respawner"
38   /etc/init.d/daemon_respawner.sh -d `basename $0` -s
39   echo "."
40   echo -n "Stopping $DAEMON ... "
41   start-stop-daemon --stop --pidfile $PIDFILE && \
42   (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi)
43   echo "done!"
44 }
45
46 case "$1" in
47
48   start)
49     do_start
50     ;;
51
52   stop)
53     do_stop
54     ;;
55
56   restart)
57     do_stop
58     do_start
59     ;;
60
61   *)
62     echo "$USAGE" >&2
63     exit 1
64     ;;
65
66 esac
67