freebsd-dev/etc/rc.d/nfsclient
Doug Barton 888d94cf9b MFC r197947:
In regards to the "Starting foo:" type messages at boot time, create
and employ a more generic solution, and use it in the individual rc.d
scripts that also have an $rc_quiet test:

1. Add check_startmsgs() to rc.subr.
2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
variations of [ -z "$rc_quiet" ] with check_startmsgs
3. In savecore add a trailing '.' to the end of the message to make it
more consistent with other scripts.
4. In newsyslog remove a : before the terminal '.' since we do not
expect there to be anything printed out in between to make it more
consistent.
5. In the following scripts change "quotes" to 'quotes' where no
variables exist in the message: savecore pf newsyslog
6. [Does not apply in RELENG_8]
7. In the following scripts separate the "Starting foo:" from the
terminal '.' to make them more consistent: moused hostname pf
8. In nfsclient move the message to its own line to avoid a style bug
9. In pf rc_quiet does not apply to the _stop method, so remove the
test there.
10. In motd add 'quotes' around the terminal '.' for consistency

Approved by:	re (kib)
2009-10-16 00:17:09 +00:00

51 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: nfsclient
# REQUIRE: NETWORKING mountcritremote rpcbind
# KEYWORD: nojail shutdown
. /etc/rc.subr
name="nfsclient"
rcvar="nfs_client_enable"
start_cmd="nfsclient_start"
stop_cmd="unmount_all"
required_modules="nfsclient:nfs"
nfsclient_start()
{
#
# Set some nfs client related sysctls
#
if [ -n "${nfs_access_cache}" ]; then
check_startmsgs &&
echo "NFS access cache time=${nfs_access_cache}"
if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then
warn "failed to set access cache timeout"
fi
fi
if [ -n "${nfs_bufpackets}" ]; then
if ! sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null; then
warn "failed to set vfs.nfs.bufpackets"
fi
fi
unmount_all
}
unmount_all()
{
# If /var/db/mounttab exists, some nfs-server has not been
# successfully notified about a previous client shutdown.
# If there is no /var/db/mounttab, we do nothing.
if [ -f /var/db/mounttab ]; then
rpc.umntall -k
fi
}
load_rc_config $name
run_rc_command "$1"