The one great thing about Linux is your can make many easy things happen in simple way with your favorite shell.



Someday, I need to take a nap for about an hour. It turned out with this script:



sleep 1h ; while true; do (aplay /usr/share/sounds/error.wav &) ; sleep 0.5 ; done


It will keep playing the audio every half a second until you press Control+C to terminate this script. I actually didn't put it in a shell script file, just simply run it. You probably noticed that I play the audio in a background sub process, the reason to do that is you can make sure that you terminate the script not the command aplay.



What if you need a precise time? It's easy, too.


while [[ $(date +%H%M) != "1011" ]]; do sleep 1; done && while true; do (aplay /usr/share/sounds/error.wav &) ; sleep 0.5 ; done

It calls date to check the time every a second. Once got the time, it will move to next while loop which plays audio.



Remember to man sleep and man date to check up more options for your needs.



Disclaimer: This post is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. If these two scripts couldn't raise you awareness of whatsoever and caused your loss, it is not my business! It has the possibility that your computer may get damaged if the scripts users are already an alarm clock killer, e.g.















(Hey! the alarm clock, not the chick.)



:-)