aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-08-30 19:25:30 +0000
committerBill Nottingham <notting@redhat.com>1999-08-30 19:25:30 +0000
commit2f8e71b3d768e283002ab30aca50632db5b662f2 (patch)
treed98b5c54f544cb5534c4d200969b7d0d9643fe51
parentd7bf5d3a141a3951496f1af58f191144594250bd (diff)
downloadinitscripts-2f8e71b3d768e283002ab30aca50632db5b662f2.tar
initscripts-2f8e71b3d768e283002ab30aca50632db5b662f2.tar.gz
initscripts-2f8e71b3d768e283002ab30aca50632db5b662f2.tar.bz2
initscripts-2f8e71b3d768e283002ab30aca50632db5b662f2.tar.xz
initscripts-2f8e71b3d768e283002ab30aca50632db5b662f2.zip
new NFS unmounting stuff from Bill Rugolsky <rugolsky@ead.dsa.com>
-rwxr-xr-xrc.d/init.d/netfs31
1 files changed, 27 insertions, 4 deletions
diff --git a/rc.d/init.d/netfs b/rc.d/init.d/netfs
index 51b508ac..b681658a 100755
--- a/rc.d/init.d/netfs
+++ b/rc.d/init.d/netfs
@@ -25,9 +25,9 @@ fi
NFSFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'`
SMBFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^smbfs$/ && $4 !~ /noauto/) print $2}'`
NCPFSTAB=`grep -v '^#' /etc/fstab | awk '{ if ($3 ~ /^ncpfs$/ && $4 !~ /noauto/) print $2}'`
-NFSMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^nfs$/ && $4 !~ /noauto/) print $2}'`
-SMBMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^smbfs$/ && $4 !~ /noauto/) print $2}'`
-NCPMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^ncpfs$/ && $4 !~ /noauto/) print $2}'`
+NFSMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^nfs$/ ) print $2}'`
+SMBMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^smbfs$/ ) print $2}'`
+NCPMTAB=`grep -v '^#' /proc/mounts | awk '{ if ($3 ~ /^ncpfs$/ ) print $2}'`
# See how we were called.
case "$1" in
@@ -39,7 +39,30 @@ case "$1" in
action "Mounting other filesystems" mount -a
;;
stop)
- [ -n "$NFSMTAB" ] && action "Unmounting NFS filesystems" umount -a -t nfs
+ [ -n "$NFSMTAB" ] && {
+ if [ $# -eq 1 ]; then
+ sig=
+ retry=3
+ remaining=`awk '!/^#/ && $3 ~ /^nfs/ {print $2}' /proc/mounts`
+ while [ -n "$remaining" -a "$retry" -gt 0 ]
+ do
+ if [ "$retry" -lt 3 ]; then
+ action "Unmounting NFS filesystems (retry)" umount -f -a -t nfs
+ else
+ action "Unmounting NFS filesystems" umount -f -a -t nfs
+ fi
+ sleep 2
+ remaining=`awk '!/^#/ && $3 ~ /^nfs/ {print $2}' /proc/mounts`
+ [ -z "$remaining" ] && break
+ lsof -N
+ fuser -k -m $sig $remaining >/dev/null
+ sleep 5
+ retry=`expr $retry - 1`
+ sig=-9
+ done
+
+ fi
+ }
[ -n "$SMBMTAB" ] && action "Unmounting SMB filesystems" umount -a -t smbfs
[ -n "$NCPMTAB" ] && action "Unmounting NCP filesystems" umount -a -t ncpfs
rm -f /var/lock/subsys/netfs