Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > e38ca06602ed901faf3c98d160039f99 > files > 1

VultureNG-1.0-7mdv2010.0.noarch.rpm

#!/bin/sh
#
# Vulture -- INTRINsec Reverse Proxy
#
# chkconfig:   345 90 15
# description: INTRINsec Reverse Proxy
# processname: 
# pidfile: /var/www/VultureNG/conf/Vulture.pid

# Install this file in /etc/init.d and run "chkconfig vultureng on" and
# "chkconfig --add vultureng".

# Source function library.
. /etc/init.d/functions

export PREFIX=/var/www
export NAME=VultureNG
export TMPDIR=/tmp
export HTTPD=httpd

# Source an auxiliary options file if we have one, and pick up OPTIONS,
if [ -r /etc/sysconfig/vultureng ] ; then
	. /etc/sysconfig/vultureng
fi

RETVAL=0

function start() {
	gprintf "Starting %s: " "${NAME}"
	daemon "${HTTPD} -f ${PREFIX}/${NAME}/conf/httpd.conf"
        RETVAL=$?
	for i in `ls ${PREFIX}/${NAME}/conf/[0-9]+.conf 2> /dev/null`; do 
                daemon "${HTTPD} -f $i"
        done
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/vultureng
	return $RETVAL
}

function stop() {
        # Stop daemons.
	gprintf "Stopping %s: " "${NAME}"
        pidfile="${PREFIX}/${NAME}/conf/Vulture.pid"
	if [ -s $pidfile ]; then
	    kill `cat $pidfile`
	fi
	RETVAL=$?
	for i in `ls ${PREFIX}/${NAME}/conf/[0-9]+.pid 2> /dev/null`; do 
	    kill `cat $i` 
        done
	[ $RETVAL -eq 0 ] && success || failure
	echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/vultureng
	return $RETVAL
}

function status() {
        pidfile="${PREFIX}/${NAME}/conf/Vulture.pid"
        if [ -s $pidfile ]; then
                pid=`cat $pidfile`
                kill -0 $pid >/dev/null 2>&1
                if [ "$?" = "0" ]; then
                        gprintf "%s (pid %s) is running\n" "${NAME}" "$pid"
                        RETVAL=0
                else
                        gprintf "%s is stopped\n" "${NAME}"
                        RETVAL=1
                fi
        else
                gprintf "%s is stopped\n" "${NAME}"
                RETVAL=1
        fi
	return $RETVAL
}

restart() {
	stop
	start
}

# See how we were called.
case "$1" in
	start)
		start
	;;
	stop)
		stop
	;;
	restart)
		restart
	;;
	condrestart)
		# Only restart if it is already running.
		status >/dev/null 2>&1 && restart
	;;
	reload)
		reload
	;;
	status)
		status
	;;
	*)
		gprintf "Usage: %s {start|stop|restart|status}\n" "${NAME}"
		exit 1
	;;
esac

exit $RETVAL