Home » Questions » Computers [ Ask a new question ]

automate: finding non-used servers from a list of servers

automate: finding non-used servers from a list of servers

i posted this on stack overflow but a user recommended i post here. sorry for cross posting:

Asked by: Guest | Views: 295
Total answers/comments: 2
Guest [Entry]

"Thanks for the suggestions. Here is my script for anyone that is interested:

#! /usr/bin/env bash

out=avail.txt
rm -f ""$HOME/$out""
minLoad=1
for h in $(cat ""$HOME/listofservers.txt""); do
##w | head -1 | cut -d : -f 5 - | cut -d "","" -f 2 -
load=`ssh username@$h uptime | cut -d : -f 5 - | cut -d "","" -f 2 -`
comparison=`expr $load \< $minLoad`
if [ comparison ]; then
echo ""$h"" >> ""$HOME/$out""
##echo ""$load"" >> ""$HOME/$out""
fi
done

PS We do have SGE installed. However, what I'm doing doesn't play well with SGE yet. Thanks."
Guest [Entry]

Install the Sun Grid Engine. Or Hudson.