I am having a big problem with lost internet connections with my DSL.

I would like to create a log to be able to show the technician when he comes next week.

I have this.

while true; do
date >> Internet_Connection_Log.txt
echo >> Internet_Connection_Log.txt
ping -c 1 >> Internet_Connection_Log.txt
echo >> Internet_Connection_Log.txt
sleep 180

I would like for it to only log pings that generate 100% packet loss. Thanks.

  • Perhaps: ping -c1 | grep 100 >> Internet_Connection_Log.txt – chili555 Jan 12 at 21:56
  • journalctl $(type -p NetworkManager) will show the logs the system already has. – waltinator Jan 13 at 3:34
# Ubuntu_Mate 18.04 LTS
# Internet log of connection failures

while : ; do
     if ! ping  -c 1 ; then
          printf "\n%s\n" "ping failed at $(date)" >> /home/andy/bin/Internet_Connection_FAILURES_Log.txt
          cvlc --play-and-exit /usr/share/sounds/My_Sounds/Alarm-sound-buzzer.mp3
     sleep 60

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.