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/nfsclient ] && . /etc/sysconfig/nfsclient
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 if is_yes "$NFS4" ; then
42 if grep -q nfs4 /proc/filesystems; then
43 modprobe -s nfs > /dev/null 2>&1
44 if [ "$(kernelverser)" -ge "002006" ]; then
45 grep -q rpc_pipefs /proc/filesystems && \
46 ! grep -q rpc_pipefs /proc/mounts && \
47 run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
49 if [ ! -f /var/lock/subsys/idmapd ]; then
50 msg_starting "NFS idmapd"
51 daemon rpc.idmapd $RPCIDMAPOPTIONS
52 [ $? -eq 0 ] && touch /var/lock/subsys/idmapd
54 if [ ! -f /var/lock/subsys/gssd ]; then
55 msg_starting "NFS gssd"
56 daemon rpc.gssd -m $RPCGSSOPTIONS
57 [ $? -eq 0 ] && touch /var/lock/subsys/gssd
61 run_cmd "Mounting NFS filesystems" mount -a -t nfs
62 touch /var/lock/subsys/nfsfs
64 msg_already_running "NFSFS"
69 if [ -f /proc/mounts ]; then
75 show "Unmounting NFS filesystems"
78 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
79 while [ -n "$remaining" -a $retry -gt 0 ]; do
80 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
82 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
84 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
88 if is_yes "$NFS4" ; then
89 if grep -q nfs4 /proc/filesystems; then
90 if [ -f /var/lock/subsys/gssd ]; then
91 msg_stopping "NFS gssd"
93 rm -f /var/lock/subsys/gssd
95 if [ -f /var/lock/subsys/idmapd -a ! -f /var/lock/subsys/nfs ]; then
96 msg_stopping "NFS idmapd"
98 rm -f /var/lock/subsys/idmapd
102 rm -f /var/lock/subsys/nfsfs
105 # See how we were called.
114 if [ -f /proc/mounts ]; then
115 echo "Configured NFS mountpoints:"
116 grep -v '^#' /etc/fstab | \
117 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
118 echo "Active NFS mountpoints:"
119 grep -v '^#' /proc/mounts | \
120 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
122 echo "/proc filesystem unavailable"
133 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"