Skip to content

Instantly share code, notes, and snippets.

@samos123
Created October 6, 2016 04:42
Show Gist options
  • Save samos123/261c9a87a5e933c1a23b6b75d6a560ae to your computer and use it in GitHub Desktop.
Save samos123/261c9a87a5e933c1a23b6b75d6a560ae to your computer and use it in GitHub Desktop.
Small script to check connectivity through ping periodically on openwrt routers
#!/bin/ash
today=$(date +"%d-%m-%Y")
time=$(date -I'seconds')
echo "Pinging 8.8.8.8 at $time" >> /var/log/ping-check-$today
ping -c 5 8.8.8.8 | grep -E "round-trip|packet loss" >> /var/log/ping-check-$today
# Optionally create a cron job to execute every minute
# Contrab: */1 * * * * /root/ping-check.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment