I have many hosts as following. But those hosts are dual operating system (Linux and Windows). I always run program background. If someone is using Linux, it is fine. But if someone is using windows or the host is offline. Then, I cannot use ssh. The way I do preiviously is first ssh one by one. And then find the hosts which are offline or windows. And write them down one by one. And then ssh to hosts except them. Let us assume the number of programs is less than the total available hosts. Can someone write a shell script to output the all available hosts to a file like "host_available"?
Here is the host file.
https://www.dropbox.com/s/vbz6w864y3...tlist.txt?dl=0
I am using ssh to connect the computers on campus. If the computer I am trying to connect is offline or using windows, the ssh will take long time, and finally it will failed. I write a shell script to generate the hostlist
Code:
#!/bin/bash
for i in `seq -w 1 28`
do
echo "c15-0330-$i.ad.mtu.edu"
# I would like to add a command here to see whether ssh c15-0330-$i.ad.mtu.edu it succeeds or not. And then output a #file which contains the all available host.
done
for i in `seq -w 1 20`
do
echo "c28-0112-$i.ad.mtu.edu"
done
for i in `seq -w 1 20`
do
echo "c28-112a-$i.ad.mtu.edu"
done
I do not how to set a certain time to see whether connection is successful or not (see the comment in the shell script).