2 ################################################################################
5 # Description: Remounts exported file systems from a machine
6 # Author: Andrew DeFaria (defaria@cup.hp.com)
8 # Created: Tue Apr 21 11:59:57 PDT 1998
9 # Status: Experimental (Do Not Distribute)
10 # Modifications: Removed the grep "(everyone)". In the past file systems were
11 # exported to everyone and that is no longer the case. This does
12 # mean that this script might attempt to mount things it can't
13 # but there is no easy way to ascertain if the current machine
14 # is allowed to mount given showmount -e output, especially if
15 # that output is a netgroup. I could check this via ypmatch
16 # but that'll take yet more smarts...
19 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
21 ################################################################################
22 # Set me to command name
26 adm_base=${adm_base:-$HOME/adm}
29 adm_fpath=${adm_fpath:-$adm_base/functions}
34 if [ $(id -u) -ne 0 ]; then
35 print -u2 "$me: Error: You must be root to execute this command!"
39 if [[ "$OS" = "10" ]] ; then
46 print -u2 "Usage: <remote machine> [ <remote machine> ]"
50 function remount_filesystem {
53 mount_over_directory=/tmp_mnt/net/$machine$2
54 if [ ! -d $mount_over_directory ]; then
55 print Making $mount_over_directory
56 mkdir -p $mount_over_directory
59 if [ ! -d $mount_over_directory/lost+found ]; then
60 print Mounting $machine:$mount_directory to $mount_over_directory
61 $mount $machine:$mount_directory $mount_over_directory
63 if [ $status -ne 0 ]; then
64 print -u2 "Warning: Unable to mount $machine:$mount_directory
65 $mount_over_directory (Status: $?)"
68 } # remount_filesystem
70 function kick_automounter {
71 automount_pid=$(ps -ef | grep automount | grep -v "grep automount" | grep -v "fix_automounts" | awk '{print $2}')
73 print Kicking automounter \($automount_pid\)
74 kill -HUP $automount_pid
77 if [ "$OS" = "10" ]; then
78 showmount=/usr/sbin/showmount
80 showmount=/usr/etc/showmount
83 for remote in "$@"; do
84 exported_filesystems=$($showmount -e $remote | grep -v "export list" |
86 for filesystem in $exported_filesystems; do
87 remount_filesystem $remote $filesystem