#!/bin/sh # # Startup script for hulamanager # # chkconfig: 345 86 16 # description: This is the initscript for the Hula project's hulamanager daemon # processname: hulamanager # Source function library. . /etc/rc.d/init.d/functions DAEMON_DIR=/usr/sbin DAEMON_NAME=hulamanager DAEMON_SETUP=hulasetup DAEMON_LIST="hulamanager huladmc hulanmap hulasmtp hulawebadmin hulaimap hulamodweb hulapop3" DATADIR=/var/mdb OPTIONS= [ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME start() { if [ ! -d $DATADIR ] ; then HOSTNAME=`/bin/hostname` DNS_SERVER=`sed -e 's/nameserver//' -e '2,$d' -e 's/ //' < /etc/resolv.conf` action $"Initializing hula: " $DAEMON_DIR/$DAEMON_SETUP --domain=$HOSTNAME --dns=$DNS_SERVER RETVAL=$? if [ $RETVAL -ne 0 ] ; then return $RETVAL fi fi $DAEMON_DIR/$DAEMON_NAME $OPTIONS >/dev/null 2>&1 & RETVAL=$? if [ $RETVAL -eq 0 ]; then action $"Starting hula: " /bin/true else action $"Starting hula: " /bin/false fi [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON_NAME return $RETVAL } stop() { RETVAL=$? # Try to play nice first $DAEMON_DIR/$DAEMON_NAME -s >/dev/null 2>&1 & sleep 15 # Now force all procs down for foo in $DAEMON_LIST; do killproc $foo >/dev/null 2>&1 done if [ $RETVAL -eq 0 ]; then action $"Shutting down hula: " /bin/true else action $"Shutting down hula: " /bin/false fi [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON_NAME return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status $DAEMON_NAME ;; reload|restart) $0 stop $0 start ;; *) gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0" exit 1 esac exit 0