From: Ricardo Markiewicz Date: Wed, 13 Jul 2005 03:22:05 +0000 (+0000) Subject: * Fancy ping all con colorcitos :) X-Git-Tag: svn_import~23 X-Git-Url: https://git.llucax.com/z.facultad/75.43/tp2.git/commitdiff_plain/e65495ed876c6dc9ea0d8e1581a3c11f56693e76?ds=inline;hp=a2328473be38b5c2613dec9c23a3327d01f16ec4 * Fancy ping all con colorcitos :) --- diff --git a/pingall.sh b/pingall.sh new file mode 100755 index 0000000..d8d8657 --- /dev/null +++ b/pingall.sh @@ -0,0 +1,34 @@ + +hosts='www.google.com.ar alf1 alf3 friends65 csi93 action1 action2 brigada34 +brigada33 seinfeld2 trfs194 simpson10 trfs199 action10 trfs193 gazer.com.ar +swat37 swat38 heman130 dukes196 dukes193 dukes194 simpsons2 simpsons1' + +# Comandos +TPUT=/usr/bin/tput +EXPR=/usr/bin/expr + +# Variables lindas +RED=`$TPUT setaf 1` +GREEN=`$TPUT setaf 2` +NORMAL=`$TPUT op` +COLS=`$TPUT cols` +if [ -n "$COLS" ]; then + COL=`$EXPR $COLS - 8` +else + COL=72 +fi +END=`$TPUT hpa $COL` + +# Codigo Fancy +for i in $hosts ; do + echo -n "Probando host $i ..." + ping -c 3 $i > /dev/null 2>&1 + if [ "x$?" = "x0" ] ; then + echo "$END[$GREEN ok $NORMAL]" + else + echo "$END[$RED Down $NORMAL]" + fi +done + + +