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