I want to get a growl notification any time my internet connection changes state - for instance, when wifi comes online, wifi goes offline, or when I switch from wifi to wired. I would love it if there was already an app out there that did this, but I'm definitely open to home-baked solutions. Any pointers?

  • Get your internet fixed so it doesn't go offline? This almost seems like an xy problem to me.
    – Tyson
    Commented Apr 27, 2016 at 1:35
  • @Tyson - Cool, thanks for being dismissive. There's nothing wrong with my internet; my connection changes state for completely ordinary reasons. I simply want a notification when it happens.
    – wxactly
    Commented Apr 27, 2016 at 6:00

1 Answer 1


I have a home-grown script that uses a rather inelegant polling mechanism to identify open network connections, and takes action based on what it finds. In short, it turns my wifi on or off depending on if it's plugged into a LAN. This to avoid connecting our corporate LAN with our visitors wifi. It uses ifconfig to obtain this data.

It's fairly easy to identify which interface routes your public internet, using netstat -r I think.

To the determine if the connected internet is actually working, I would probably using ping -c 1 www.google.com or something and see which code ping exits with to determine if it's alive.

All very "sticks and strings" I'm afraid. But you did say you're open to that!

  • 1
    This sounds promising - do you have a working example in bash or something that you can attach to this answer?
    – wxactly
    Commented Apr 27, 2016 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .