"Fossies" - the Fresh Open Source Software Archive

Member "freeha-1.0/service_scripts/vip.stop" (23 Nov 2006, 1418 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 unplumb a "virtual IP" used by cluster services               #
    5 # Provided as a tool to be called from 'stophasrv'                        #
    6 #                                                                         #
    7 # USAGE:   vip.stop IP                                                    #
    8 #    EG:   vip.stop 10.3.5.7                                              #
    9 #             (MUST be ip addr, not name)                                 #
   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 ERROR: no IP specified
   24     exit 1
   25 fi
   26 
   27 case "$1" in 
   28     [1-9]*)
   29         ;;
   30     *)
   31         echo vip.stop: ERROR: address must be given as IP numbers
   32         exit 1
   33 esac
   34 
   35 
   36 #uses same algorithm as vip.monitor
   37 name=`ifconfig -a | awk '
   38 $1 ~ /:/    {split($1,nic,":"); 
   39                  lastif=sprintf("%s:%s",nic[1],nic[2]);}
   40 $2 == "'$1'"    { print lastif ; exit; }
   41 
   42 '`
   43 
   44 
   45 if [ "$name" = "" ] ; then
   46     echo vip.stop: IP address $1 not present.
   47     exit 0
   48 fi
   49 
   50 
   51 ifconfig $name unplumb
   52