ports/net/freeradius2/files/radiusd.sh.in
Wesley Shields 2bdb8e8cc7 - If radiusd_flags did not contain -d all arguments would be incorrectly added
to required_dirs and cause the script to block.
- If radiusd_flags contains -s the daemon never forks so deal with this by
  adding & to command_args.

PR:		ports/144969, ports/144970
Submitted by:	Ryan Steinmetz <rpsfa@rit.edu> (maintainer)
2010-04-11 11:43:26 +00:00

49 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: radiusd
# REQUIRE: %%REQUIRE%%
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable radiusd:
#
# radiusd_enable="YES"
#
. /etc/rc.subr
name=radiusd
rcvar=`set_rcvar`
load_rc_config $name
command=%%PREFIX%%/sbin/radiusd
# In debug mode, radiusd doesn't create a pid file, so comment pidfile and
# let rc.subr use a process check on procname (which defaults to command).
#pidfile=/var/run/radiusd/radiusd.pid
extra_commands="reload debug"
debug_cmd="radiusd_debug"
# The radiusd_config parameter is now obsolete. Instead, derive the
# configuration directory name from radiusd_flags if possible, otherwise
# default to %%PREFIX%%/etc/raddb
required_dirs=`echo ${radiusd_flags} | sed -Ene 's:.*\-[^[:space:]d]*d[[:space:]]*([^[:space:]]+).*:\1:p'`
required_dirs=${required_dirs:-"%%PREFIX%%/etc/raddb"}
required_files="${required_dirs}/radiusd.conf"
radiusd_enable=${radiusd_enable-"NO"}
command_args="&"
radiusd_debug()
{
radiusd_flags="-X ${radiusd_flags}"
run_rc_command start
}
run_rc_command "$1"