Created
November 2, 2011 06:24
-
-
Save MarcelloDuarte/1333029 to your computer and use it in GitHub Desktop.
My improvised PHP alarm
This file contains 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/London'); | |
$alarm = '06:00'; | |
$musicFileToPlay = '~/Music/4\ non\ blondes/1-01\ Train.mp3'; | |
$open = 'open'; // change this to what is the command in you OS. This works for MacOSX | |
while (true) { | |
$date = date('H:i', time()); | |
sleep(30); | |
if ($alarm === $date) { | |
echo 'Wake up!'; | |
system ("$open $musicFileToPlay"); | |
exit(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment