Hi Guys,
I am looking to optimze these 5 SSH lines to a single SSH to get my machine to not hang! lol!
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} top -b > util/{}.top &' >> r_query_info
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} uname -r > util/{}.osv &' >> r_query_info
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} psrinfo -vp > util/{}.core &' >> r_query_info
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} isainfo -kv > util/{}.cpu &' >> r_query_info
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} psrinfo -v > util/{}.speed &' >> r_query_info
where hosts.lst is just a file of 2 hosts, home/util/timeout arg1 arg2 is a timeout script. It basically will stop ssh after 6 minutes or a 0 return code.
I would appreciate if any help could be provided in combining all these hardware status commands.
Thanks,
If you remove the "&" from the end of each command they will all run sequentially rather than in parallel, that may be all you need to do?
First off, you get a [url=Partmaps.org]UUOC Award[/url=
cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} top -b > util/{}.top &' >> r_query_info
is better as
xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} top -b > util/{}.top &' >> r_query_info < hosts.lst
To combine them... hm... I'm not quite sure what it's all doing. Is it creating files locally, remotely, or both?
Put all of those commands in a script and run the script instead.
As per your suggestions, i thought to put it in a script but i am getting some problems.
This is the statement i came up with?
ssh -q $HOST 'vmstat -w > util/$1.vmstat 2> $LOG_FILE; uname -rv > util/$1.osv 2> $LOG_FILE; prtconf > util/$1.core 2> $LOG_FIL
E; instfix -i > util/$1.ml 2> $LOG_FILE; lsconf > util/$1.speed 2> $LOG_FILE' &
This creates some problems. Can any1 tell me if this is correct?
Variables are not expanded inside single quotes. Things like $LOG_FILE will expand on the remote server instead, probably to nothing.