tcsh: fix warning to keep compiling with WARNS=2
[dragonfly.git] / etc / rc.d / nfsclient
blob1683fe56f535a9f68085d6dfd9eab9723e378370
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $
4 # $DragonFly: src/etc/rc.d/nfsclient,v 1.6 2005/11/19 21:47:32 swildner Exp $
7 # PROVIDE: nfsclient
8 # REQUIRE: NETWORKING mountcritremote rpcbind
9 # KEYWORD: shutdown
11 . /etc/rc.subr
13 name="nfsclient"
14 rcvar="nfs_client_enable"
15 start_cmd="nfsclient_start"
16 start_precmd="nfsclient_precmd"
17 stop_cmd="unmount_all"
19 # Load nfs module if it was not compiled into the kernel
20 nfsclient_precmd()
22 if ! sysctl vfs.nfs >/dev/null 2>&1; then
23 if ! kldload nfs; then
24 warn 'Could not load nfs module'
25 return 1
28 return 0
31 nfsclient_start()
34 # Set some nfs client related sysctls
36 echo -n "NFS CLIENT:"
37 if [ -n "${nfs_access_cache}" ]; then
38 sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
40 if [ -n "${nfs_neg_cache}" ]; then
41 sysctl vfs.nfs.neg_cache_timeout=${nfs_neg_cache} >/dev/null
43 if [ -n "${nfs_bufpackets}" ]; then
44 sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
46 echo -n " access_cache_timeout=`sysctl -n vfs.nfs.access_cache_timeout`"
47 echo -n " neg_cache_timeout=`sysctl -n vfs.nfs.neg_cache_timeout`"
48 unmount_all
51 unmount_all()
53 # If /var/db/mounttab exists, some nfs-server has not been
54 # successfully notified about a previous client shutdown.
55 # If there is no /var/db/mounttab, we do nothing.
57 if checkyesno rpc_umntall_enable; then
58 if [ -f /var/db/mounttab ]; then
59 echo -n ' rpc.umntall'
60 rpc.umntall -k
64 load_rc_config $name
65 run_rc_command "$1"
67 echo '.'