xref: /freebsd/libexec/rc/rc.d/nfsclient (revision f99f0ee14e3af81c23150a6a340259ca8a33d01a)
10696600cSBjoern A. Zeeb#!/bin/sh
20696600cSBjoern A. Zeeb#
30696600cSBjoern A. Zeeb#
40696600cSBjoern A. Zeeb
50696600cSBjoern A. Zeeb# PROVIDE: nfsclient
60696600cSBjoern A. Zeeb# REQUIRE: NETWORKING mountcritremote rpcbind
70696600cSBjoern A. Zeeb# KEYWORD: nojail shutdown
80696600cSBjoern A. Zeeb
90696600cSBjoern A. Zeeb. /etc/rc.subr
100696600cSBjoern A. Zeeb
110696600cSBjoern A. Zeebname="nfsclient"
120696600cSBjoern A. Zeebdesc="NFS client setup"
130696600cSBjoern A. Zeebrcvar="nfs_client_enable"
140696600cSBjoern A. Zeebstart_cmd="nfsclient_start"
150696600cSBjoern A. Zeebstop_cmd="unmount_all"
160696600cSBjoern A. Zeebrequired_modules="nfscl:nfs"
170696600cSBjoern A. Zeeb
180696600cSBjoern A. Zeebnfsclient_start()
190696600cSBjoern A. Zeeb{
200696600cSBjoern A. Zeeb	#
210696600cSBjoern A. Zeeb	# Set some nfs client related sysctls
220696600cSBjoern A. Zeeb	#
230696600cSBjoern A. Zeeb
240696600cSBjoern A. Zeeb	if [ -n "${nfs_access_cache}" ]; then
25325ebf37SJose Luis Duran		startmsg "NFS access cache time=${nfs_access_cache}"
260696600cSBjoern A. Zeeb		if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then
270696600cSBjoern A. Zeeb			warn "failed to set access cache timeout"
280696600cSBjoern A. Zeeb		fi
290696600cSBjoern A. Zeeb	fi
300696600cSBjoern A. Zeeb	if [ -n "${nfs_bufpackets}" ]; then
310696600cSBjoern A. Zeeb		if ! sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null; then
320696600cSBjoern A. Zeeb			warn "failed to set vfs.nfs.bufpackets"
330696600cSBjoern A. Zeeb		fi
340696600cSBjoern A. Zeeb	fi
350696600cSBjoern A. Zeeb
360696600cSBjoern A. Zeeb	unmount_all
370696600cSBjoern A. Zeeb}
380696600cSBjoern A. Zeeb
390696600cSBjoern A. Zeebunmount_all()
400696600cSBjoern A. Zeeb{
410696600cSBjoern A. Zeeb	# If /var/db/mounttab exists, some nfs-server has not been
420696600cSBjoern A. Zeeb	# successfully notified about a previous client shutdown.
430696600cSBjoern A. Zeeb	# If there is no /var/db/mounttab, we do nothing.
440696600cSBjoern A. Zeeb	if [ -f /var/db/mounttab ]; then
450696600cSBjoern A. Zeeb		rpc.umntall -k
460696600cSBjoern A. Zeeb	fi
470696600cSBjoern A. Zeeb}
480696600cSBjoern A. Zeebload_rc_config $name
49*f99f0ee1SAlexander Leidinger
50*f99f0ee1SAlexander Leidinger# no unmounting in svcj
51*f99f0ee1SAlexander Leidingernfsclient_svcj="NO"
52*f99f0ee1SAlexander Leidinger
530696600cSBjoern A. Zeebrun_rc_command "$1"
54