NFS mounted /usr/local

Another quick hack for FreeBSD.

I have NFS mounted /usr/local on my lab’s FreeBSD boxes, built by FreeBSD ports. It has its own local startup directory, /usr/local/etc/rc.d . However, they aren’t launched at startup because /usr/local isn’t mounted when /etc/rc determines the order to kick (rc.subr based) scripts in /etc/rc.d and /usr/local/etc/rc.d.

Fortunately, we have an exception in this case. Legacy *.sh scripts are kicked by /etc/rc.d/locakpkg, as the final process of startup. So, I wrote /usr/local/etc/rc.d/local_startup.sh to kick rc.subr based scripts. It works pretty good!

#!/bin/sh
. /etc/rc.subr
load_rc_config 'XXX'
case ${local_startup} in
[Nn][Oo] | '') ;;
*)      find_local_scripts_new ;;
esac
files=`rcorder ${skip} ${local_rc} 2>/dev/null`
_boot="start"
for _rc_elem in ${files}; do
run_rc_script ${_rc_elem} ${_boot}
done
echo ''

Hmm, I think this script must support “stop”, not only “start”…

コメントを残す