Snippets

Edel SM Host route watchdog

Created by Edelberto Mania last modified
#!/bin/bash
# Test route going to a single host IP in AWS network
# $1 is the gateway to test
# Edelberto Mania <ed@zenoradio.com>
# 20160501

H=172.29.0.183/32
ip ro add ${H} via $1
ip ro flush cache
ping -qnc2 $(echo ${H}|sed 's/\/32//g') >/dev/null
RET=$? # 0=alive, otherwise NON-OK
ip ro del ${H} via $1

## decide whato do based on $RET - but for now, display.
echo "RET is: ${RET}"

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.