Script to Check Internet Connection and Create Notification on Apple Mac
I’ve decided to create a script for my Mac to check internet connection and create notifications. After some research, surprisingly it’s very easy and I only need a few lines of shell script.
To trigger notification on Apple Mac only needs one line of Applescript. AppleScript can be run from the shell using
I use the
ping command to check internet connection. If the exit status is equal to zero, it means my Mac is connected to the internet.
Below is the completed script, you can get it on Github.
- How can I trigger a Notification Center notification from an AppleScript or shell script?
- Displaying Notifications
- Register to Digital Ocean cloud with this link and get $200 credit
- Looking for cheap CDN? Bunny is the answer
- Alternative Cloud besides AWS and Digital Ocean