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
29 # Check that networking is up.
30 if is_yes "${NETWORKING}"; then
31 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
32 msg_network_down nfsfs
40 if [ ! -f /var/lock/subsys/nfsfs ]; then
41 run_cmd "Mounting NFS filesystems" mount -a -t nfs
42 if is_yes "$NFS4" ; then
43 if grep -q nfs4 /proc/filesystems; then
44 modprobe -s nfs > /dev/null 2>&1
45 if [ "$(kernelverser)" -ge "002006" ]; then
46 grep -q rpc_pipefs /proc/filesystems && \
47 ! grep -q rpc_pipefs /proc/mounts && \
48 run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
50 if [ ! -f /var/lock/subsys/idmapd ]; then
51 msg_starting "NFS idmapd"
52 daemon rpc.idmapd $RPCIDMAPOPTIONS
53 [ $? -eq 0 ] && touch /var/lock/subsys/idmapd
55 if [ ! -f /var/lock/subsys/gssd ]; then
56 msg_starting "NFS gssd"
57 daemon rpc.gssd -m $RPCGSSOPTIONS
58 [ $? -eq 0 ] && touch /var/lock/subsys/gssd
60 run_cmd "Mounting NFSv4 filesystems" mount -a -t nfs4
63 touch /var/lock/subsys/nfsfs
65 msg_already_running "NFSFS"
70 if [ -f /proc/mounts ]; then
76 if is_yes "$NFS4" ; then
77 if grep -q nfs4 /proc/filesystems; then
78 show "Unmounting NFSv4 filesystems"
81 remaining=$(awk '$3 == "nfs4" {print $2}' $fsfile)
82 while [ -n "$remaining" -a $retry -gt 0 ]; do
83 fuser -msk -TERM `awk '$3 == "nfs4" {print $2}' < $fsfile`
85 fuser -msk -KILL `awk '$3 == "nfs4" {print $2}' < $fsfile`
87 remaining=$(awk '$3 == "nfs4" {print $2}' $fsfile)
91 if [ -f /var/lock/subsys/gssd ]; then
92 msg_stopping "NFS gssd"
94 rm -f /var/lock/subsys/gssd
96 if [ -f /var/lock/subsys/idmapd -a ! -f /var/lock/subsys/nfs ]; then
97 msg_stopping "NFS idmapd"
99 rm -f /var/lock/subsys/idmapd
103 show "Unmounting NFS filesystems"
106 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
107 while [ -n "$remaining" -a $retry -gt 0 ]; do
108 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
110 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
112 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
116 rm -f /var/lock/subsys/nfsfs
119 # See how we were called.
128 if [ -f /proc/mounts ]; then
129 echo "Configured NFS mountpoints:"
130 grep -v '^#' /etc/fstab | \
131 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
132 echo "Active NFS mountpoints:"
133 grep -v '^#' /proc/mounts | \
134 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
136 echo "/proc filesystem unavailable"
147 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"