Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nc -z hostname 22 > /dev/null
- echo $?
- nc -z localhost 22
- -z Specifies that nc should just scan for listening daemons,
- without sending any data to them.
- nc -vzw 1 hostname 22
- MACHINE=192.168.0.8
- exec 3>/dev/tcp/${MACHINE}/22
- if [ $? -eq 0 ]
- then
- echo "SSH up"
- else
- echo "SSH down"
- fi
Add Comment
Please, Sign In to add comment