#!/usr/bin/env bash # $Id: ipassoc.sh 9804 2010-06-22 18:36:49Z alex $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/scripts/network/domr/ipassoc.sh $ # ipassoc.sh -- associate/disassociate a public ip with an instance # # # 2.1.4 usage() { printf "Usage:\n %s -A -i -l -r [-f] \n" $(basename $0) >&2 printf " %s -D -i -l -r [-f] \n" $(basename $0) >&2 } cert="/root/.ssh/id_rsa.cloud" domRIp=$1 shift # check if gateway domain is up and running check_gw() { ping -c 1 -n -q $1 > /dev/null if [ $? -gt 0 ] then sleep 1 ping -c 1 -n -q $1 > /dev/null fi return $?; } # Check if DomR is up and running. If not, exit with error code 1. check_gw "$domRIp" if [ $? -gt 0 ] then exit 1 fi ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/ipassoc.sh $*" exit $?