FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

os:linux:check:scripts:check_ping_gw.sh.html



Linux Operation with Fabric (ope.py)

check_ping_gw.sh

$FHHOME/target/scripts/check_ping_gw.sh


check_ping_gw.sh

#!/bin/bash
#==============================================================================
# check_ping_gw.sh
#
# How to use
#     chek_ping_gw.sh
#==============================================================================

LANG=C

TMPFILE=/tmp/tmp.$$
ERROR=0

for i  in `route -n | awk {'print $2'} | grep -Evi "IP|Gateway|0.0.0.0"`
do
    ping -i 0.25 -c 3 -w 2 $i > ${TMPFILE}
    if [ $?  -ne 0 ] ; then
        ERROR=1
    fi
    tail -n 3 ${TMPFILE}
    rm ${TMPFILE}
done


if [ $ERROR -eq 1 ] ; then
   echo "ping NG"
   exit 1
fi

   echo "ping OK"
exit 0


Example



os/linux/check/scripts/check_ping_gw.sh.html.txt ยท Last modified: 2018/02/04 23:57 by kurihara