]> git.pld-linux.org Git - packages/hula.git/blob - hula.init
- attempt to organize files
[packages/hula.git] / hula.init
1 #!/bin/sh
2 #
3 # Startup script for hulamanager
4 #
5 # chkconfig: 345 86 16
6 # description: This is the initscript for the Hula project's hulamanager daemon 
7 # processname: hulamanager
8
9
10 # Source function library.
11 . /etc/rc.d/init.d/functions
12
13 DAEMON_DIR=/usr/sbin
14 DAEMON_NAME=hulamanager
15 DAEMON_SETUP=hulasetup
16 DAEMON_LIST="hulamanager huladmc hulanmap hulasmtp hulawebadmin hulaimap hulamodweb hulapop3"
17 DATADIR=/var/mdb
18 OPTIONS=
19
20 [ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME
21
22 start() {
23         if [ ! -d $DATADIR ] ; then
24                 HOSTNAME=`/bin/hostname`
25                 DNS_SERVER=`sed -e 's/nameserver//' -e '2,$d' -e 's/ //' < /etc/resolv.conf`
26                 action $"Initializing hula: " $DAEMON_DIR/$DAEMON_SETUP --domain=$HOSTNAME --dns=$DNS_SERVER
27                 RETVAL=$?
28                 if [ $RETVAL -ne 0 ] ; then
29                         return $RETVAL
30                 fi
31         fi
32         $DAEMON_DIR/$DAEMON_NAME $OPTIONS >/dev/null 2>&1 & 
33         RETVAL=$?
34         if [ $RETVAL -eq 0 ]; then
35                 action $"Starting hula: " /bin/true
36         else
37                 action $"Starting hula: " /bin/false
38         fi
39         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON_NAME
40         return $RETVAL
41 }
42
43 stop() {
44         RETVAL=$?
45         # Try to play nice first
46         $DAEMON_DIR/$DAEMON_NAME -s >/dev/null 2>&1 &
47         sleep 15
48         
49         # Now force all procs down
50         for foo in $DAEMON_LIST;
51         do
52                 killproc $foo >/dev/null 2>&1
53         done
54         if [ $RETVAL -eq 0 ]; then
55                 action $"Shutting down hula: " /bin/true
56         else
57                 action $"Shutting down hula: " /bin/false
58         fi
59         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON_NAME
60         return $RETVAL
61 }
62
63 case "$1" in
64   start)
65         start
66         ;;
67   stop)
68         stop
69         ;;
70   status)
71         status $DAEMON_NAME
72         ;;
73   reload|restart)
74         $0 stop
75         $0 start
76         ;;
77   *)
78         gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
79         exit 1
80 esac
81
82 exit 0
This page took 0.064859 seconds and 3 git commands to generate.