Skip to content

Instantly share code, notes, and snippets.

@kushal-r
Created March 30, 2020 14:27
Show Gist options
  • Select an option

  • Save kushal-r/e87f29b4ff74488ba2fe44b42e040709 to your computer and use it in GitHub Desktop.

Select an option

Save kushal-r/e87f29b4ff74488ba2fe44b42e040709 to your computer and use it in GitHub Desktop.
#!/bin/bash
for filename in servers/*.txt; do
for server in $(cat $filename)
do
user_name=$(cut -d'.' -f1 <<<$filename)
user_name=$(cut -d'/' -f2 <<<$user_name)
#echo $user_name
if ssh $user_name'@'$server "true"
then
echo "Server $server: OK"
else
echo "Server $server: NOT CONNECTED"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment