umountnfs.sh 711 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides: umountnfs
  4. # Required-Start:
  5. # Required-Stop: umountfs
  6. # Should-Stop: $network $portmap
  7. # Default-Start:
  8. # Default-Stop: 0 6
  9. # Short-Description: Unmount all network filesystems
  10. ### END INIT INFO
  11. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  12. # Write a reboot record to /var/log/wtmp before unmounting
  13. halt -w
  14. echo "Unmounting remote filesystems..."
  15. test -f /etc/fstab && (
  16. #
  17. # Read through fstab line by line and unount network file systems
  18. #
  19. while read device mountpt fstype options
  20. do
  21. if test "$fstype" = nfs || test "$fstype" = smbfs || test "$fstype" = ncpfs || test "$fstype" = cifs
  22. then
  23. umount -f $mountpt
  24. fi
  25. done
  26. ) < /etc/fstab
  27. : exit 0