Portál AbcLinuxu, 14. srpna 2025 09:55
#!/bin/bash NODE="192.168.0.6" #IP of the node COUNT=5 #how many failed pings in a row to traceroute SLEEP=60 #timeout between pings EMAIL="user@host" #where to send traceroute output I=0; while true do ping -c 1 $NODE 1&>/dev/null if [ $? -eq 1 ] then I=`expr 1 + $I` else I=0; fi sleep $SLEEP if [ $I -eq $COUNT ] then #print to screen /usr/sbin/traceroute $NODE | head -n 5 #mail it #echo `/usr/sbin/traceroute $NODE | head -n 5` | mail $EMAIL` I=0 fi done
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.