Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ################################################################################
- # AUTHOR: Vladimir Vuksan
- # E-mail: Check http://vuksan.com/linux/
- # License: GPL
- ################################################################################
- if [ $# -ne 1 ]; then
- echo "Usage: $0 <hostname>"
- exit;
- fi
- # Get the IP of the host then do traceroute against it.
- IP=`/usr/bin/gethostip ${1} | cut -f2 -d" "`
- TRACEROUTE=`/usr/sbin/traceroute ${IP} 2>&1 | grep "(${IP}) "`
- RESULT=`echo $TRACEROUTE | grep -c ms`
- if [ $RESULT -eq 1 ]; then
- echo TRACERT OK: `echo $TRACEROUTE | cut -f4- -d" "`
- exit 0
- else
- echo TRACERT CRITICAL: Host unreachable
- exit 2
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement