Created
November 9, 2015 10:47
-
-
Save CodeBrauer/ba5352d51ddb836f39ef to your computer and use it in GitHub Desktop.
Easy internet-connection checker - If Internet connection works: plays sound
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| /usr/bin/php /Users/xxx/dev/internetz.php | |
| exit; | |
| # This file can be opened with default Terminal App on Mac OS X |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| date_default_timezone_set('Europe/Berlin'); | |
| for (;;) { | |
| if (@fsockopen('google.de', 80, $errno, $errstr, 1)) { | |
| shell_exec('osascript -e "set Volume 2"'); | |
| for ($i=0; $i < 5; $i++) { | |
| shell_exec('/usr/bin/afplay /Users/xxx/dev/horn.m4a'); | |
| } | |
| exit('YAY - INTERNET!'); | |
| } else { | |
| echo date('[ d.m.Y H:i:s ] - ') . "Still no internet..." . PHP_EOL; | |
| } | |
| sleep(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment