Hi everyone.
I've installed FreeRADIUS, but it has one small thing about it which causes unexpected complications. It requires (by OpenSSL) tmpdir=/tmp/radiusd to exist for the server to start. Wouldn't be a problem, but I've set clear_tmp_enable="YES" in my /etc/rc.conf, which leaves /tmp clean upon reboot.
No problem, /tmp/radiusd can be created manually without even special permissions... But in order to enable automatic daemon startup on boot I've used the rc.subr(8) variable start_precmd as a recommended way to add extra actions to the rc startup script:
My unsophisticated custom code here works fine when invoked by ordinary user (me) and successfully creates /tmp/radiusd, but from the startup script it doesn't create anything. What might be the problem here? One doesnt' need any special permissions to create things in the /tmp dir, and startup scripts are run by root, are they not?
I've installed FreeRADIUS, but it has one small thing about it which causes unexpected complications. It requires (by OpenSSL) tmpdir=/tmp/radiusd to exist for the server to start. Wouldn't be a problem, but I've set clear_tmp_enable="YES" in my /etc/rc.conf, which leaves /tmp clean upon reboot.
No problem, /tmp/radiusd can be created manually without even special permissions... But in order to enable automatic daemon startup on boot I've used the rc.subr(8) variable start_precmd as a recommended way to add extra actions to the rc startup script:
Code:
#blablabla
. /etc/rc.subr
name=radiusd
rcvar=radiusd_enable
load_rc_config $name
command=/usr/local/sbin/radiusd
extra_commands="reload debug"
debug_cmd="radiusd_debug"
required_dirs=`echo ${radiusd_flags} | sed -Ene 's:.*\-[^[:space:]d]*d[[:space:]]*([^[:space
:]]+).*:\1:p'`
required_dirs=${required_dirs:-"/usr/local/etc/raddb"}
required_files="${required_dirs}/radiusd.conf"
radiusd_enable=${radiusd_enable-"NO"}
command_args="&"
[B]start_precmd="${radiusd_prestart}"[/B]
radiusd_debug()
{
radiusd_flags="-X ${radiusd_flags}"
run_rc_command start
}
[B]radiusd_prestart()
{
if [ ! -d /tmp/radiusd ]; then
/bin/mkdir /tmp/radiusd
fi
}[/B]
run_rc_command "$1"