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