3 # nfsfs Mount NFS filesystems.
5 # Version: @(#) /etc/init.d/skeleton 1.01 26-Oct-1993
7 # Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
10 # description: Mounts and unmounts all Network File System (NFS) \
15 # Source networking configuration.
16 if [ ! -f /etc/sysconfig/network ]; then
20 # Source function library.
21 . /etc/rc.d/init.d/functions
24 . /etc/sysconfig/network
27 [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs
28 [ -f /etc/sysconfig/nfslock ] && . /etc/sysconfig/nfslock
30 # Check that networking is up.
31 if is_yes "${NETWORKING}"; then
32 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
33 msg_network_down nfsfs
40 if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then
41 [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0
45 if [ ! -f /var/lock/subsys/nfsfs ]; then
46 if ! grep -q rpc_pipefs /proc/mounts ; then
47 modprobe -s sunrpc > /dev/null 2>&1
48 run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \
49 mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
52 # Set the ports lockd should listen on
53 if [ -n "$LOCKD_TCPPORT" ]; then
54 /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
56 if [ -n "$LOCKD_UDPPORT" ]; then
57 /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
60 # Special case /usr first
61 if awk '{ if ($2 == "/usr" && $3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) exit 1}' /etc/fstab ; then
62 run_cmd "Mounting /usr filesystem" mount /usr
63 # In case of /usr over NFS idmapd, gssd and lockd may not start
64 # check if they're running and try to start them if not
65 /sbin/service idmapd status >/dev/null || /sbin/service idmapd start
66 /sbin/service gssd status >/dev/null || /sbin/service gssd start
67 /sbin/service nfslock status >/dev/null || /sbin/service nfslock start
69 run_cmd "Mounting NFS filesystems" mount -a -t nfs,nfs4
70 touch /var/lock/subsys/nfsfs
73 msg_already_running "NFSFS"
78 if [ -f /proc/mounts ]; then
84 show "Unmounting NFS filesystems"
87 remaining=$(awk '$3 ~ /^nfs(4$|$)/ {print $2}' $fsfile)
88 while [ -n "$remaining" -a $retry -gt 0 ]; do
89 fuser -msk -TERM `awk '$3 ~ /^nfs(4$|$)/ {print $2}' < $fsfile`
91 fuser -msk -KILL `awk '$3 ~ /^nfs(4$|$)/ {print $2}' < $fsfile`
92 umount -a -f -t nfs,nfs4
93 remaining=$(awk '$3 ~ /^nfs(4$|$)/ {print $2}' $fsfile)
97 rm -f /var/lock/subsys/nfsfs
100 # See how we were called.
109 if [ -f /proc/mounts ]; then
110 echo "Configured NFS mountpoints:"
111 grep -v '^#' /etc/fstab | \
112 awk '{ if ($3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) print $2}'
113 echo "Active NFS mountpoints:"
114 grep -v '^#' /proc/mounts | \
115 awk '{ if ($3 ~ /^nfs(4$|$)/ && $4 !~ /noauto/) print $2}'
117 echo "/proc filesystem unavailable"
128 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"