]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-http-getter
ocaml 3.09 transition
[helm.git] / helm / scripts / init.d / helm-http-getter
1 #!/bin/sh
2 #
3 # init.d script for http_getter
4 #
5 # by --Zack <zack@cs.unibo.it>
6 # Created: Tue,  8 Oct 2002 17:18:17 +0200
7 # Last-Modified: Fri, 16 Apr 2004 18:21:30 +0200
8
9 DAEMON="/projects/helm/daemons/http_getter/http_getter.opt"
10 USAGE="Usage: /etc/init.d/helm-http-getter { 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 --background --pidfile $PIDFILE --make-pidfile \
23     --chuid $OWNER --exec $DAEMON
24   echo "done!"
25   echo -n "Starting $DAEMON respawner"
26   /etc/init.d/daemon_respawner.sh -p $PIDFILE \ -m root@localhost \
27     -r http://localhost:58081/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