Question

i have to take uptime of my nodes pool in jenkins. I looking for decision a lot and found that there is only way is to connect on each node via ssh and check their status with uptime time. i'am new in bash, and now i write a simple script wich will connect on one machine, but smth wrong and i have got no output at all

for 3A1A; do
ssh 3A1A "bash -s" < uptime
done
Was it helpful?

Solution

Please try following:

arr=("list of IPs separated by space")
for i in ${arr[*]}
do
echo -n "$i " 
ssh user1@$i "uptime" 

done

user user1 should be able to access all IPs or we will have to use key value(associative arrays) instead of this simple one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top