rc.d - Use kldstat -m to test existance before kldload
[dragonfly.git] / etc / rc.d / nfsclient
bloba596051e1fb5a5bb5d1bcc806193db67943e5305
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $
6 # PROVIDE: nfsclient
7 # REQUIRE: NETWORKING mountcritremote rpcbind
8 # KEYWORD: shutdown
10 . /etc/rc.subr
12 name="nfsclient"
13 rcvar="nfs_client_enable"
14 start_cmd="nfsclient_start"
15 start_precmd="nfsclient_precmd"
16 stop_cmd="unmount_all"
18 # Load nfs module if it was not compiled into the kernel
19 nfsclient_precmd()
21 kldstat -m nfs || kldload -n nfs || return 1
22 return 0
25 nfsclient_start()
28 # Set some nfs client related sysctls
30 echo -n "NFS CLIENT:"
31 if [ -n "${nfs_access_cache}" ]; then
32 sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
34 if [ -n "${nfs_neg_cache}" ]; then
35 sysctl vfs.nfs.neg_cache_timeout=${nfs_neg_cache} >/dev/null
37 if [ -n "${nfs_bufpackets}" ]; then
38 sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
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
45 unmount_all()
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.
51 if checkyesno rpc_umntall_enable; then
52 if [ -f /var/db/mounttab ]; then
53 echo -n ' rpc.umntall'
54 rpc.umntall -k
58 load_rc_config $name
59 run_rc_command "$1"
61 echo '.'