Поэтому моя идея заключалась в перенаправлении вывод ping в текстовый файл и напишите цикл, чтобы неоднократно ограничивать указанный файл 20 строками:
Код: Выделить всё
ping ServerX.domain.com -i 5 -D 1>/home/user/Desktop/Ping.txt &
while :
do
tail /home/user/Desktop/Ping.txt -n 20 >/home/user/Desktop/Ping.txt
done
Код: Выделить всё
ping ServerX.domain.com -i 5 -D >/home/user/Desktop/Ping.txt &
while :
do
PingContent=$(tail /home/user/Desktop/Ping.txt -n 20)
echo "$PingContent" >/home/user/Desktop/Ping.txt
sleep 4
done
Подробнее здесь: https://stackoverflow.com/questions/787 ... st-x-lines
Мобильная версия