Skip to content

Instantly share code, notes, and snippets.

@tcaddy
Last active September 23, 2020 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcaddy/2e8a71da0966b9b972d8255a285f09c4 to your computer and use it in GitHub Desktop.
Save tcaddy/2e8a71da0966b9b972d8255a285f09c4 to your computer and use it in GitHub Desktop.
ping_gateway
#!/bin/sh
# See https://serverfault.com/a/31179
gateway=$(route -n | grep 'UG[ \t]' | awk '{print $2}')
echo "Pinging Gateway IP: $gateway"
echo "Press CTRL + C to cancel"
ping $gateway
@tcaddy
Copy link
Author

tcaddy commented Sep 23, 2020

Run this on Ubuntu on my laptop to keep wireless from going to sleep / power save.

Also nice to run on OpenWRT routes to make sure ISP is pingable.

Also nice to run on my Raspberry Pi Zero to keep it responsive on the network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment