2 ################################################################################
6 # Description: A script to mount all nfs mounts. Note if the automounter is
7 # running then this script will first shutdown the automounter.
8 # This script returns 0 for success or non zero if it was unable
9 # to umount all nfs mounts. This script must run as root.
10 # Author: Andrew DeFaria, California Language Labs
11 # Created: Fri Jun 6 10:31:51 PDT 1997
13 # Language: Korn Shell
15 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
17 ################################################################################
18 # Set me to command name
22 adm_base=${adm_base:-$HOME/adm}
25 adm_fpath=${adm_fpath:-$adm_base/functions}
31 error "This script must be run as root" 1
34 integer automount_pid=$(process_is_running automount)
37 if [ $automount_pid -ne 0 ]; then
38 print "Attempting to shutdown the automounter..."
39 kill -15 $automount_pid
41 print "Waiting for the automounter to shutdown..."
45 while [ $max_tries -ne 0 ]; do
47 automount_pid=$(process_is_running automount)
48 process_is_running automount
49 if [ $automount_pid -ne 0 ]; then
50 print "The automounter ($automount_pid) is still running!"
51 print "I will wait $max_tries more time\c"
52 if [ $max_tries -gt 1 ]; then
55 print ". Waiting $wait_time seconds..."
60 let max_tries=max_tries-1
64 automount_pid=$(process_is_running automount)
65 if [ $automount_pid -ne 0 ]; then
66 print "The automounter has not shutdown! Continuing..."
68 print "The automounter has been shut down successfully"
69 touch /etc/automounter_was_here
72 print "\nAttempting to unmount all nfs mounts"
73 if [ "$OS" = "09" ]; then
76 /usr/sbin/umount -a -F nfs
79 integer nfs_mounts_left=$(grep -c "nfs" /etc/mnttab)
81 if [ $nfs_mounts_left -eq 0 ]; then
82 print "All nfs filesystems have been successfully unmounted!"
86 if [ $nfs_mounts_left -eq 1 ]; then
87 print "is one filesystem left mounted:\n"
89 print "are $nfs_mounts_left filesystems left mounted:\n"