19c600e7dSMatthew Dillon#!/bin/sh 29c600e7dSMatthew Dillon# 39c600e7dSMatthew Dillon# $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $ 49c600e7dSMatthew Dillon# 59c600e7dSMatthew Dillon 69c600e7dSMatthew Dillon# PROVIDE: nfsclient 7*ce083385SAaron LI# REQUIRE: rpcbind 8696a5717SSascha Wildner# KEYWORD: shutdown 99c600e7dSMatthew Dillon 109c600e7dSMatthew Dillon. /etc/rc.subr 119c600e7dSMatthew Dillon 129c600e7dSMatthew Dillonname="nfsclient" 139c600e7dSMatthew Dillonrcvar="nfs_client_enable" 149c600e7dSMatthew Dillonstart_cmd="nfsclient_start" 159c600e7dSMatthew Dillonstart_precmd="nfsclient_precmd" 169c600e7dSMatthew Dillonstop_cmd="unmount_all" 179c600e7dSMatthew Dillon 189c600e7dSMatthew Dillon# Load nfs module if it was not compiled into the kernel 199c600e7dSMatthew Dillonnfsclient_precmd() 209c600e7dSMatthew Dillon{ 210dfdc028SAntonio Huete Jimenez kldstat -qm nfs || kldload -n nfs || return 1 229c600e7dSMatthew Dillon return 0 239c600e7dSMatthew Dillon} 249c600e7dSMatthew Dillon 259c600e7dSMatthew Dillonnfsclient_start() 269c600e7dSMatthew Dillon{ 279c600e7dSMatthew Dillon # 2814791e19SThomas Nikolajsen # Set some nfs client related sysctls 299c600e7dSMatthew Dillon # 30d615ff4fSMatthew Dillon echo -n "NFS CLIENT:" 319c600e7dSMatthew Dillon if [ -n "${nfs_access_cache}" ]; then 32b0a4258dSAaron LI ${SYSCTL_W} vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null 339c600e7dSMatthew Dillon fi 34d615ff4fSMatthew Dillon if [ -n "${nfs_neg_cache}" ]; then 35b0a4258dSAaron LI ${SYSCTL_W} vfs.nfs.neg_cache_timeout=${nfs_neg_cache} >/dev/null 36d615ff4fSMatthew Dillon fi 379c600e7dSMatthew Dillon if [ -n "${nfs_bufpackets}" ]; then 38b0a4258dSAaron LI ${SYSCTL_W} vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null 399c600e7dSMatthew Dillon fi 40b0a4258dSAaron LI echo -n " access_cache_timeout=`${SYSCTL_N} vfs.nfs.access_cache_timeout`" 41b0a4258dSAaron LI echo -n " neg_cache_timeout=`${SYSCTL_N} vfs.nfs.neg_cache_timeout`" 429c600e7dSMatthew Dillon unmount_all 439c600e7dSMatthew Dillon} 449c600e7dSMatthew Dillon 459c600e7dSMatthew Dillonunmount_all() 469c600e7dSMatthew Dillon{ 479c600e7dSMatthew Dillon # If /var/db/mounttab exists, some nfs-server has not been 489c600e7dSMatthew Dillon # successfully notified about a previous client shutdown. 499c600e7dSMatthew Dillon # If there is no /var/db/mounttab, we do nothing. 5072067a39SMatthew Dillon 5172067a39SMatthew Dillon if checkyesno rpc_umntall_enable; then 529c600e7dSMatthew Dillon if [ -f /var/db/mounttab ]; then 5372067a39SMatthew Dillon echo -n ' rpc.umntall' 5490b4813cSThomas Nikolajsen rpc.umntall -k 5572067a39SMatthew Dillon fi 569c600e7dSMatthew Dillon fi 579c600e7dSMatthew Dillon} 58e54c8dc8SAaron LI 599c600e7dSMatthew Dillonload_rc_config $name 609c600e7dSMatthew Dillonrun_rc_command "$1" 61304e4a39SThomas Nikolajsen 62304e4a39SThomas Nikolajsenecho '.' 63