#! /usr/bin/perl # # Author: Kevin C. Miller # http://www.andrew.cmu.edu/~kevinm/dhcp/failover.html # # The copyright is with the author. We (SuSE) include this script # with his permission. # # NOTE: you have to edit this script to make it functional for you. use Expect; if ($#ARGV == -1 ) { print "Usage: $0 [IP to reset] [server to reset on]\n"; print "In most cases only one server needs to have the IP reset\n"; print "and it generates the updates to get things in sync.\n"; exit 1; } # Fill in your OMAPI key my $KEY = ""; my $con = Expect->spawn("omshell"); $con->send("key defomapi $KEY\n"); $con->send("server $ARGV[1]\n"); $con->send("connect\n"); sleep(1); $con->send("new lease\nset ip-address = $ARGV[0]\n"); sleep(1); $con->send("open\n"); $con->send("set state = 1\n"); $con->send("update\n"); sleep(2);