]> git.pld-linux.org Git - packages/hula.git/blame - hula.init
- tabs in preamble
[packages/hula.git] / hula.init
CommitLineData
5099cb00 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
13DAEMON_DIR=/usr/sbin
14DAEMON_NAME=hulamanager
15DAEMON_SETUP=hulasetup
16DAEMON_LIST="hulamanager huladmc hulanmap hulasmtp hulawebadmin hulaimap hulamodweb hulapop3"
17DATADIR=/var/mdb
18OPTIONS=
19
20[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME
21
22start() {
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
92b06a62 41}
92b06a62 42
5099cb00 43stop() {
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}
92b06a62 62
5099cb00 63case "$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
80esac
81
82exit 0
This page took 0.073587 seconds and 4 git commands to generate.