Guest User

Untitled

a guest
Feb 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. nc -z hostname 22 > /dev/null
  2. echo $?
  3.  
  4. nc -z localhost 22
  5.  
  6. -z Specifies that nc should just scan for listening daemons,
  7. without sending any data to them.
  8.  
  9. nc -vzw 1 hostname 22
  10.  
  11. MACHINE=192.168.0.8
  12. exec 3>/dev/tcp/${MACHINE}/22
  13. if [ $? -eq 0 ]
  14. then
  15. echo "SSH up"
  16. else
  17. echo "SSH down"
  18. fi
Add Comment
Please, Sign In to add comment