1#!/bin/sh 2# 3# $FreeBSD$ 4# 5 6# PROVIDE: nfsclient 7# REQUIRE: NETWORKING mountcritremote rpcbind 8# KEYWORD: nojail shutdown 9 10. /etc/rc.subr 11 12name="nfsclient" 13desc="NFS client setup" 14rcvar="nfs_client_enable" 15start_cmd="nfsclient_start" 16stop_cmd="unmount_all" 17required_modules="nfscl:nfs" 18 19nfsclient_start() 20{ 21 # 22 # Set some nfs client related sysctls 23 # 24 25 if [ -n "${nfs_access_cache}" ]; then 26 startmsg "NFS access cache time=${nfs_access_cache}" 27 if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then 28 warn "failed to set access cache timeout" 29 fi 30 fi 31 if [ -n "${nfs_bufpackets}" ]; then 32 if ! sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null; then 33 warn "failed to set vfs.nfs.bufpackets" 34 fi 35 fi 36 37 unmount_all 38} 39 40unmount_all() 41{ 42 # If /var/db/mounttab exists, some nfs-server has not been 43 # successfully notified about a previous client shutdown. 44 # If there is no /var/db/mounttab, we do nothing. 45 if [ -f /var/db/mounttab ]; then 46 rpc.umntall -k 47 fi 48} 49load_rc_config $name 50run_rc_command "$1" 51