check if a machine is responding on a given port - try until it is responding then say something


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/bin/bash
  2.  
  3. while true; do
  4. if nc -w 1 -z $1 $2; then
  5. say "server $1 is responding on port $2"
  6. exit
  7. else
  8. echo -n "#"
  9. sleep 5
  10. fi
  11. done

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.