I want to test connectivity between different servers with my server using information as IP and port only.
I have Name,IP List and port in one file. Please help how i can test connectivity is successful or not?
File format will be:
Name1,127.0.0.1,80
Name2,127.0.0.2,8080
Output could be
Name1, Successful
Name2, Unsuccessful
I have prepare the code which uses curl and execute complete URL which is as follows:
##############code####################
for url in $(awk -F"," '{print $3}' cp_urls.txt)
do
curl -s -o "/dev/null" $url
if [ $? -eq 0 ] ; then
echo "$url = running"
else
echo "$url = not running"
fi
done
################emd####################
But i don't want to test connectivity with complete url as it provides the hit to url,but using IP and port number specified in file.
Please suggest.