1#!/bin/sh 2# 3# $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $ 4# 5 6# PROVIDE: nfsclient 7# REQUIRE: NETWORKING mountcritremote rpcbind 8# KEYWORD: shutdown 9 10. /etc/rc.subr 11 12name="nfsclient" 13rcvar="nfs_client_enable" 14start_cmd="nfsclient_start" 15start_precmd="nfsclient_precmd" 16stop_cmd="unmount_all" 17 18# Load nfs module if it was not compiled into the kernel 19nfsclient_precmd() 20{ 21 kldstat -m nfs || kldload -n nfs || return 1 22 return 0 23} 24 25nfsclient_start() 26{ 27 # 28 # Set some nfs client related sysctls 29 # 30 echo -n "NFS CLIENT:" 31 if [ -n "${nfs_access_cache}" ]; then 32 sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null 33 fi 34 if [ -n "${nfs_neg_cache}" ]; then 35 sysctl vfs.nfs.neg_cache_timeout=${nfs_neg_cache} >/dev/null 36 fi 37 if [ -n "${nfs_bufpackets}" ]; then 38 sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null 39 fi 40 echo -n " access_cache_timeout=`sysctl -n vfs.nfs.access_cache_timeout`" 41 echo -n " neg_cache_timeout=`sysctl -n vfs.nfs.neg_cache_timeout`" 42 unmount_all 43} 44 45unmount_all() 46{ 47 # If /var/db/mounttab exists, some nfs-server has not been 48 # successfully notified about a previous client shutdown. 49 # If there is no /var/db/mounttab, we do nothing. 50 51 if checkyesno rpc_umntall_enable; then 52 if [ -f /var/db/mounttab ]; then 53 echo -n ' rpc.umntall' 54 rpc.umntall -k 55 fi 56 fi 57} 58load_rc_config $name 59run_rc_command "$1" 60 61echo '.' 62