]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-http-getter_mowgli
Bug fixed: Helm_registry was used not enough lazily (i.e. before loading
[helm.git] / helm / scripts / init.d / helm-http-getter_mowgli
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: Wed,  8 Jan 2003 12:09:41 +0100
8
9 DAEMON="/projects/helm/daemons/http_getter/http_getter.opt"
10 USAGE="Usage: /etc/init.d/helm-http-getter_mowgli { start | stop | restart }"
11
12 ENVSCRIPT=""
13 if [ -f /etc/default/helm_mowgli ]; then
14   . /etc/default/helm_mowgli
15 fi
16 if ! [ -f "$ENVSCRIPT" ]; then
17   echo "Can't find environment script '$ENVSCRIPT'"
18   exit 1
19 fi
20 . $ENVSCRIPT &> /dev/null
21
22 NAME=`basename $DAEMON`
23 PIDFILE=/var/run/"$NAME"_mowgli.pid
24
25 do_start () {
26   echo "Starting $DAEMON ..."
27   start-stop-daemon \
28     --start --background --pidfile $PIDFILE --make-pidfile \
29     --chuid $OWNER --exec $DAEMON
30 }
31
32 do_stop () {
33   echo "Stopping $DAEMON ..."
34   start-stop-daemon --stop --pidfile $PIDFILE && \
35   (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi)
36 }
37
38 case "$1" in
39
40   start)
41     do_start
42     ;;
43
44   stop)
45     do_stop
46     ;;
47
48   restart)
49     do_stop
50     do_start
51     ;;
52
53   *)
54     echo "$USAGE" >&2
55     exit 1
56     ;;
57
58 esac
59