]> git.llucax.com Git - z.facultad/75.43/tp2.git/blob - pingall.sh
* Agrego host_por_red
[z.facultad/75.43/tp2.git] / pingall.sh
1
2 hosts='alf1 alf3 friends65 csi193 action1 action2 brigada34 
3 brigada33 seinfeld2 trfs194 simpson10 trfs199 action10 trfs193 gazer.com.ar
4 swat37 swat38 heman130 dukes196 dukes193 dukes194 simpsons2 simpsons1'
5
6 # Comandos
7 TPUT=/usr/bin/tput
8 EXPR=/usr/bin/expr
9
10 # Variables lindas
11 RED=`$TPUT setaf 1`
12 GREEN=`$TPUT setaf 2`
13 NORMAL=`$TPUT op`
14 COLS=`$TPUT cols`
15 if [ -n "$COLS" ]; then
16         COL=`$EXPR $COLS - 8`
17 else
18         COL=72
19 fi
20 END=`$TPUT hpa $COL`
21
22 # Codigo Fancy
23 for i in $hosts ; do
24         echo -n "Probando host $i ..."
25         ping -c 3 $i > /dev/null 2>&1
26         if [ "x$?" = "x0" ] ; then
27                 echo "$END[$GREEN  ok  $NORMAL]"
28         else
29                 echo "$END[$RED Down $NORMAL]"
30         fi
31 done
32
33
34