aboutsummaryrefslogblamecommitdiff
path: root/net/exaddos/files/exaddos.in
blob: 48bdc4f99ec12d44752059db32d5aef4052a72c8 (plain) (tree)

























































                                                                   
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: exaddos
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line(s) to /etc/rc.conf to enable exaddos:
#
# exaddos_enable="YES"

. /etc/rc.subr

name=exaddos
rcvar=exaddos_enable

load_rc_config $name

exaddos_enable=${exaddos_enable:-"NO"}
exaddos_conf=${exaddos_conf:-"%%ETCDIR%%/exaddos.conf"}

pidfile=/var/run/${name}/${name}.pid

required_files=${exaddos_conf}

command="%%PYTHON_SITELIBDIR%%/${name}/application.py"
procname="%%PYTHON_CMD%%"

start_cmd="exaddos_start"
reload_all_cmd="exaddos_reload_all"
extra_commands="reload reload_all"
sig_reload="USR1"

exaddos_start()
{
	if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
		echo 1>&2 "${name} already running? (pid=$rc_pid)."
		return 1
	fi

	echo "Starting ${name}."

	install -d -o exaddos -g exaddos -m 755 /var/run/${name}
	install -d -o exaddos -g exaddos -m 750 /var/db/${name}
	rm -f ${pidfile}

	${procname} -m exaddos.debug ${command} -c ${exaddos_conf}
}

exaddos_reload_all()
{
    	echo "Reloading exaddos configuration and processes."
	kill -USR2 $rc_pid
}


run_rc_command "$1"