This script is called by a local script that finds the group with an overload or an idle threshold pass. Its arguments are the group with the needed resources (source) and the group that needs the resource (target).
If there is an overload on WebServers of TelnetServers, the source is Idle.
If the server groups are idle, the source is the one containing the floating server.
Write your local script to call floatingServers.sh.
./floatingServers.sh source target |
For example, the floatingServers script takes those arguments in the findProfile function, which tells which profile to use in the deployServer function. The profile either installs a web server, a telnet server, or uninstalls server software (to return floating server to idle).
# ./floatingServers.sh Idle WebServers |
#! /bin/bash
host=floating
policy=YesToAll
function login {
echo -n “Type your user name:”
read user
echo -n “Type your password:”
read password
}
function deployServer {
uce_cli -sj -P “$profile” -C “$policy” -h “$host” -dp -u “$user” -p
“$password”
}
function findProfile {
sourceG=$1
targetG=$2
if [ $sourceG = “Idle” -a $targetG = “WebServers” ]; then
profile=”WebServerProfile”
elif [ $sourceG = “Idle” -a $targetG = “TelnetServers” ]; then
profile=”TelnetServerProfile”
elif [ $sourceG = “WebServers” -o $sourceG = “TelnetServers” ]; then
profile=”IdleServerProfile”
else
echo “Source is not in automated script.”
echo “From the following list of known profiles, select one to deploy on floating server”
uce_cli -lp -u “$user” -p “$password”
echo -n “Profile to deploy:”
read profile
fi
}
login
findProfile $1 $2
echo “Deploying $profile on $host to make it part of $2”
deployServer
|
If the servers in a pool are of one distribution, and the floating server is of another, you can use the BMI Server to recycle the floating server with a new Linux distribution while provisioning it with a profile. Consult with your Sun distributor for details.