]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.d/nfsclient
Add UPDATING entries and bump version.
[FreeBSD/FreeBSD.git] / etc / rc.d / nfsclient
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
12 name="nfsclient"
13 desc="NFS client setup"
14 rcvar="nfs_client_enable"
15 start_cmd="nfsclient_start"
16 stop_cmd="unmount_all"
17 required_modules="nfscl:nfs"
18
19 nfsclient_start()
20 {
21         #
22         # Set some nfs client related sysctls
23         #
24
25         if [ -n "${nfs_access_cache}" ]; then
26                 check_startmsgs &&
27                         echo "NFS access cache time=${nfs_access_cache}"
28                 if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then
29                         warn "failed to set access cache timeout"
30                 fi
31         fi
32         if [ -n "${nfs_bufpackets}" ]; then
33                 if ! sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null; then
34                         warn "failed to set vfs.nfs.bufpackets"
35                 fi
36         fi
37
38         unmount_all
39 }
40
41 unmount_all()
42 {
43         # If /var/db/mounttab exists, some nfs-server has not been
44         # successfully notified about a previous client shutdown.
45         # If there is no /var/db/mounttab, we do nothing.
46         if [ -f /var/db/mounttab ]; then
47                 rpc.umntall -k
48         fi
49 }
50 load_rc_config $name
51 run_rc_command "$1"