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
39 # See how we were called.
42 if [ ! -f /var/lock/subsys/nfsfs ]; then
43 if is_yes "$NFS4" ; then
44 if grep -q nfs4 /proc/filesystems; then
45 modprobe -s nfs > /dev/null 2>&1
46 if [ "$(kernelverser)" -ge "002006" ]; then
47 grep -q rpc_pipefs /proc/filesystems && \
48 ! grep -q rpc_pipefs /proc/mounts && \
49 run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
51 if [ ! -f /var/lock/subsys/idmapd ]; then
52 msg_starting "NFS idmapd"
53 daemon rpc.idmapd $RPCIDMAPOPTIONS
55 msg_starting "NFS gssd"
56 daemon rpc.gssd -m $RPCGSSOPTIONS
59 run_cmd "Mounting NFS filesystems" mount -a -t nfs
60 touch /var/lock/subsys/nfsfs
62 msg_already_running "NFSFS"
66 if [ -f /proc/mounts ]; then
72 show "Unmounting NFS filesystems"
75 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
76 while [ -n "$remaining" -a $retry -gt 0 ]; do
77 fuser -msk -TERM `awk '$3 == "nfs" {print $2}' < $fsfile`
79 fuser -msk -KILL `awk '$3 == "nfs" {print $2}' < $fsfile`
81 remaining=$(awk '$3 == "nfs" {print $2}' $fsfile)
85 if is_yes "$NFS4" ; then
86 if grep -q nfs4 /proc/filesystems; then
87 msg_stopping "NFS gssd"
89 if [ -f /var/lock/subsys/idmapd -a ! -f /var/lock/subsys/nfs ]; then
90 msg_stopping "NFS idmapd"
92 rm -f /var/lock/subsys/idmapd
96 rm -f /var/lock/subsys/nfsfs
99 if [ -f /proc/mounts ]; then
100 echo "Configured NFS mountpoints:"
101 grep -v '^#' /etc/fstab | \
102 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
103 echo "Active NFS mountpoints:"
104 grep -v '^#' /proc/mounts | \
105 awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'
107 echo "/proc filesystem unavailable"
118 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"