#!/bin/bash
#
# phantom v1.6
# (c)2000-2005 Marek Uher <marek.uher@t-mobile.cz>
#
# Control script for the Phantom Application Server
#

#
# Increases the current process' limit
#
#ulimit -n 32768
#ulimit -f 8192
#ulimit -u 1536

#
# Test Phantom Internet Application Server configuration
#
PHANTOM_CONF=/services/www/phantom/env/phantom.env
test -f ${PHANTOM_CONF} || exit 0
. ${PHANTOM_CONF}
PHANTOMCTL=${PHANTOM_BASE}/bin/phantomctl

trap "" 1
export LANG=C

#
# See how we were called
#
case "$1" in

	start)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} start"
	;;

	stop)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} stop"
	;;

	kill)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} kill"
	;;

	reload)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} reload"
	;;

	reload-modules)
        	su ${PHANTOM_USER} -c "${PHANTOMCTL} restartssl"
	;;

	restart)
		$0 stop
                sleep 15
		$0 start
	;;

	force-reload)
		$0 reload-modules
	;;

	help)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} help"
	;;

	status)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} status"
	;;

	fullstatus)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} fullstatus"
	;;

	info)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} info"
	;;

	configtest)
		su ${PHANTOM_USER} -c "${PHANTOMCTL} configtest"
	;;

	*)
		echo "Usage: /etc/init.d/phantom {start|stop|kill|reload|reload-modules|restart|force-reload|help|status|fullstatus|info|configtest}"
	exit 1
	;;
esac

exit 0

# /* End of file: phantom */
