]> matita.cs.unibo.it Git - helm.git/blob - helm/scripts/init.d/helm-uwobo_mowgli
f21805ab97b335933a1e59c3a2ea018e3bfe5226
[helm.git] / helm / scripts / init.d / helm-uwobo_mowgli
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: Tue,  8 Apr 2003 09:43:08 +0200 zacchiro
8
9 DAEMON="/projects/helm/daemons/uwobo/uwobo.opt"
10 USAGE="Usage: /etc/init.d/helm-uwobo_mowgli { start | stop | restart }"
11 UWOBO_FOREVER="/etc/init.d/uwobo_forever.sh"
12
13 if [ -f /etc/default/helm_mowgli ]; then
14   . /etc/default/helm_mowgli
15 fi
16
17 NAME=`basename $DAEMON`
18 # Warning: $PIDFILE value is shared by UWOBO respawner, change at your own risk
19 PIDFILE=/var/run/"$NAME"_mowgli.pid
20
21 do_start () {
22   echo -n "Starting $DAEMON ... "
23   start-stop-daemon \
24     --start --background --pidfile $PIDFILE --make-pidfile \
25     --chuid $OWNER --exec $DAEMON
26   echo "done!"
27   echo -n "Waiting for UWOBO to startup (2 seconds) ... "
28   sleep 2
29   echo "done!"
30   /etc/init.d/helm-tomcat_mowgli start
31   echo -n "Starting UWOBO respawner (uwobo_forever.sh) ... "
32   if [ -x "$UWOBO_FOREVER" ]; then
33      $UWOBO_FOREVER &
34      echo "done!"
35   else
36      echo "Can't find $UWOBO_FOREVER :-("
37   fi
38 }
39
40 do_stop () {
41   echo -n "Stopping $DAEMON ... "
42   start-stop-daemon --stop --pidfile $PIDFILE && \
43   (if [ -f $PIDFILE ]; then rm -f $PIDFILE; else true; fi)
44   echo "done!"
45   echo -n "Stopping UWOBO respawner (uwobo_forever.sh) ... "
46   killall `basename $UWOBO_FOREVER`
47   echo "done!"
48 }
49
50 case "$1" in
51
52   start)
53     do_start
54     ;;
55
56   stop)
57     do_stop
58     ;;
59
60   restart)
61     do_stop
62     do_start
63     ;;
64
65   *)
66     echo "$USAGE" >&2
67     exit 1
68     ;;
69
70 esac
71