#!/bin/sh
#
# chkconfig: 345 95 5
#
# description: Roxen is a WWW/FTP Server.
#
# processname: roxen
# hide: false

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

roxenhome=/usr/roxen/server

# If you want to start with another configuration directory:
# configdir=/etc/roxen/configurations

# Here you can add extra flags to the start script, like enabling or
# disabling threads.
flags="--with-threads"
#flags="--without-threads"

# See how we were called.
case $1 in
	start)
		# Start daemon.
		echo -n "Starting Roxen: "
		#daemon roxen
		if [ -x $roxenhome/start ]; then
		  cd $roxenhome
		  # ./RunRoxen $flags --config-dir=$configdir > /dev/null 2>&1
		  ./RunRoxen $flags > /dev/null 2>&1
		  success "Roxen startup"
		  touch /var/lock/subsys/roxen
		else
		  failure "Roxen startup"
		fi
		echo
		;;
	stop)
		echo -n "Shutting down Roxen: "
		killproc RunRoxen
	    sleep 2
		killproc roxen
		rm -f /var/lock/subsys/roxen
		echo
		;;
	restart)
		$0 stop
		$0 start
		;;
	status)
		status roxen
		exit $?
		;;
	*)
		echo "Usage: $0 {start|stop|restart|status}"
		exit 1
esac

exit 0
