Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / mount_nfs
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         unmount_nfs
5 # RCS:          $Header:$
6 # Description:  A script to unmount 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
12 # Modified:
13 # Language:     Korn Shell
14 #
15 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
16 #
17 ################################################################################
18 export me=`basename $0`
19 export OS=$(/bin/uname -r | /usr/bin/cut -f2 -d.)
20
21 if [ $(id -u) -ne 0 ]; then
22   print -u2 "$me: Error: You must be root to use this command"
23   exit 1
24 fi
25
26 # First try to mount any nfs mounts listed in /etc/checklist
27 print "Re-establishing all static NFS mounts..."
28 if [ "$OS" = "10" ]; then
29   /usr/sbin/mount -aQF nfs
30 else
31   /etc/mount -at nfs
32 fi
33
34 # Restart automounter if necessary
35 if [ -f /etc/automounter_was_here ]; then
36   print "Restarting automounter..."
37   if [ "$OS" = "10" ]; then
38     /usr/sbin/automount -f /etc/auto_master
39   else
40     /usr/etc/automount -f /etc/auto_master
41   fi
42   rm -f /etc/automounter_was_here
43 fi