Warung Online

Senin, 18 November 2013

Internet Connection Down? Get a Voice Alert When Your Mac is Back Online osxdailynews.blogspot.com

Written By Unknown; About: Internet Connection Down? Get a Voice Alert When Your Mac is Back Online osxdailynews.blogspot.com on Senin, 18 November 2013

osxdailynews.blogspot.com ® Internet Connection Down? Get a Voice Alert When Your Mac is Back Online

Detect an internet connection is back online


We’re all incredibly reliant on our internet connections these days, but sometimes those connections aren’t so reliable. Whether it’s due to an ISP failure, a router being down, someone tripping over a cord somewhere, or whatever other occurrence, it can be frustrating to wait for a downed internet connection to come alive again. We’ve all known users who simply hit the “refresh” button on a web browser repeatedly to see when things revive, but there is a better way. Users who are comfortable with the command line can use a better solution, which utilizes the ping tool to detect an active internet connection and the text-to-speech say command to verbally announce when things are live again. Be sure to have the volume turned up on the Mac to use this.


Speak an Alert when Internet Connection is Online


This command will run into a successful ping to the domain “yahoo.com” is connected. By switching the domain with another, you could also use this to monitor if a web site or server is up or down.


until ping -W1 -c1 yahoo.com; do sleep 5; done && say the internet is back


If you’re not concerned about connecting to a resolved domain name (i.e.: somedomainname.com instead of 127.0.0.1), you could also ping an IP directly, which is what the original trick source suggested:


until ping -W1 -c1 8.8.8.8; do sleep 5; done && say the internet is back


A potential issue with pinging an IP directly is that the command may return a live connection when there continue to be DNS issues. Thus the first option, which pings a resolved domain name instead, may be a better option, because not only does it detect an active internet connection but it also only triggers when domain names are resolving properly as well.


This is similar to a command line trick we covered that announces the completion of a task through speaking a defined phrase, which can be helpful when a lengthy script is running or some other task may take an indeterminate amount of time to finish where an alert would be helpful.


Silent Alternative: Alert Internet Connection Online with a Photo


For users who are working in environments where having volume on or sound up is not an option, you can adjust the command to trigger another alert action. For example, replacing the ‘say’ command with ‘open’ would allow a picture to be opened with Preview to indicate an active connection has returned:


until ping -W1 -c1 yahoo.com; do sleep 5; done && open ~/BACKONLINE.jpg


In this case, when ping succeeds in contacting yahoo, an image named “BACKONLINE.jpg” will open in Preview app (or whatever the default image app is set to for the file type defined).


Heads up to @sedovsek on Twitter for this great trick, don’t forget to follow us there too.


Email this Internet Connection Down? Get a Voice Alert When Your Mac is Back Online to a Friend! Receive Articles like this one direct to your email box! Subscribe for free today!

Tidak ada komentar:

Posting Komentar