From a bash script how can I quickly find out whether a port 80 is open/listening on a server.
On all workstations is opened daemon, but sometimes it fall, how i can check all files from file if port is open, i found a way to use
nc -zw3 10.101.0.13 80 && echo "opened" || echo "closed"
but how to use it in bulk from a file, my writed file look like:
10.101.0.13; 3333
10.101.0.15; 3334
10.101.0.17; 4143
10.101.0.21; 1445
10.101.0.27; 2443
10.101.0.31; 2445
10.101.0.47; 3443
10.101.0.61; 3445
I have to separate working one from non working, but also with all the line. Thank you
You can use this
bash
one liner,EDIT:
Try this:
you can just loop through the file, and write the status to corresponding text files
If you want to keep the
IP; otherstuff
format, you can use this one instead