3 # nfsfs Mount NFS filesystems.
6 # description: Mounts and unmounts all Network File System (NFS) \
9 # Source networking configuration.
10 if [ ! -f /etc/sysconfig/network ]; then
14 # Source function library.
15 . /etc/rc.d/init.d/functions
18 . /etc/sysconfig/network
21 [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs
22 [ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
24 # Check that networking is up.
25 if is_yes "${NETWORKING}"; then
26 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
27 msg_network_down nfsfs
34 if [ "$1" != "stop" ]; then
35 check_portmapper || { nls "Error: portmap isn't running" && exit 0; }
39 if [ ! -f /var/lock/subsys/nfsfs ]; then
40 # Set the ports lockd should listen on
41 if [ -n "$LOCKD_TCPPORT" ]; then
42 /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
44 if [ -n "$LOCKD_UDPPORT" ]; then
45 /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
48 # Special case /usr first
49 if ! awk '{ if ($2 == "/usr" && $3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) exit 1}' /etc/fstab ; then
50 run_cmd "Mounting /usr filesystem" mount /usr
51 # In case of /usr over NFS idmapd, gssd and lockd may not start
52 # check if they're running and try to start them if not
53 /sbin/service idmapd status >/dev/null || /sbin/service idmapd start
54 /sbin/service gssd status >/dev/null || /sbin/service gssd start
55 /sbin/service nfslock status >/dev/null || /sbin/service nfslock start
57 run_cmd "Mounting NFS filesystems" mount -a -t nfs,nfs4
58 touch /var/lock/subsys/nfsfs
61 msg_already_running "NFSFS"
66 if [ -f /proc/mounts ]; then
72 show "Unmounting NFS filesystems"
75 remaining=$(awk '$3 ~ /^nfs(4$|$)/ {print $2}' $fsfile)
76 while [ -n "$remaining" -a $retry -gt 0 ]; do
77 fuser -msk -TERM `awk '$3 ~ /^nfs(4$|$)/ {print $2}' < $fsfile`
79 fuser -msk -KILL `awk '$3 ~ /^nfs(4$|$)/ {print $2}' < $fsfile`
80 umount -a -f -t nfs,nfs4
81 remaining=$(awk '$3 ~ /^nfs(4$|$)/ {print $2}' $fsfile)
85 rm -f /var/lock/subsys/nfsfs
88 # See how we were called.
97 if [ -f /proc/mounts ]; then
98 echo "Configured NFS mountpoints:"
99 grep -v '^#' /etc/fstab | \
100 awk '{ if ($3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) print $2}'
101 echo "Active NFS mountpoints:"
102 grep -v '^#' /proc/mounts | \
103 awk '{ if ($3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) print $2}'
105 echo "/proc filesystem unavailable"
116 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"