Sysadmin > UtilitIes > PingTest

ping utilities

see PingTest for an other version

pingtest

#!/bin/sh

if [ $# -eq 3 ]
  then cat <<HELP

pingtest <IP> <NAME>

This tool needs one ip as a parameter and a second with a
shortname/comment and will just answer with a coloured "ok" or "fail".

HELP

exit 1
fi
printf "%-15s%15s    " $1 $2; ping -q -f -c 3 -w 1 $1 > /dev/null && echo -e '\t\033[32mok\033[39m' || echo -e '\t\033[31mfail\033[39m'

On BSD you need the -W 1 instead.

pingset

#!/bin/sh
pingtest 192.168.111.1 fritzbox
pingtest 192.168.111.15 drucker
pingtest 192.168.111.16 farbdrucker
pingtest 192.168.111.77 blafuh




obsolet pingtest

A small script to check if a host is up

#!/bin/sh

if [ $# -ne 1 ]
  then cat <<HELP

pingtest <IP>

This tool need one ip as a parameter.

HELP

exit 1
fi
echo -n $1; ping -q -f -c 3 -w 1 $1 > /dev/null && echo -e '\t\033[32mok\033[39m' || echo -e '\t\033[31mfail\033[39m'

hostup

Checks if your hosts a up -- ideal for a loginscript.

#!/bin/sh
for i in 10.135.64.31 10.135.64.32 10.135.64.33
do
        pingtest $i
done

older obsolet fwping

#!/bin/sh
pingtest 10.125.66.231 fw01
pingtest 10.125.66.241 fw02

pingtest

#!/bin/sh

if [ $# -eq 3 ]
  then cat <<HELP

pingtest <IP> <NAME>

This tool needs one ip as a parameter and a second with a
shortname/comment and will just answer with a coloured "ok" or "fail".

HELP

exit 1
fi
echo -n $1; echo -n "   "$2"            "; ping -q -f -c 3 -w 1 $1 > /dev/null && echo -e '\t\033[32mok\033[39m' || echo -e '\t\033[31mfail\033[39m'