"Fossies" - the Fresh Open Source Software Archive

Member "freeha-1.0/service_scripts/fs.stop" (23 Nov 2006, 1485 Bytes) of package /linux/privat/old/freeha-1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 #-------------------------------------------------------------------------#
    4 # Script to unmount a filesystem" used by cluster services                #
    5 #  Primarily useful for when you have a filesytem on a shared disk        #
    6 # Provided as a tool to be called from 'stophasrv'                        #
    7 #                                                                         #
    8 # USAGE:  fs.stop mountpoint                                              #
    9 #    EG:  fs.stop /export/home                                            #
   10 #                                                                         #
   11 #  Standard UNIX status: returns 0 on okay, non-0 on fail.                #
   12 #-------------------------------------------------------------------------#
   13 
   14 
   15 
   16 # This is tweaked for Solaris, because that's what I have to play with.
   17 # Please submit whatever tweaks are neccessary for your favorite OS.
   18 
   19 
   20 PATH=$PATH:/usr/sbin:/sbin
   21 
   22 if [ "$1" = "" ] ; then
   23     echo fs.stop: ERROR: filesystem mountpoint not specified
   24     exit 1
   25 fi
   26 
   27 if [ ! -d $1 ] ; then
   28     echo fs.stop: ERROR: $1 is not a directory
   29     exit 1
   30 fi
   31 
   32 mount -p |grep " $1 " >/dev/null
   33 if [ $? -ne 0 ] ; then
   34     echo fs.stop: $1 not mounted. Not doing anything.
   35     exit 0
   36 fi
   37 
   38 umount $1
   39 
   40 if [ $? -ne 0 ] ; then
   41     # you WILL umount!
   42     echo fs.stop: NOTICE: attempting force umount of $1
   43     umount -f $1
   44 fi
   45 
   46 mount -p |grep " $1 " >/dev/null
   47 if [ $? -eq 0 ] ; then
   48     echo fs.stop: ERROR: umount of $1 failed.
   49     exit 1
   50 else
   51     exit 0
   52 fi
   53