How to use your Linux Machine as an Alarm January 22, 2006Posted by Carthik in commands, guides, snippets, ubuntu.
You probably leave your computer on all the time. (Linux users keep it up longer, right?)
So instead of wasting more electricity by using an alarm clock to wake you up, why not put your desktop to work as a personal alarm? Like the Task Scheduler in Windows computers, it is really, really simple to have your Linux system do things at specified times in the future. This article will guide you through the process of using your desktop as a musical alarm.
Note: If you prefer player X and I use player Y in the examples below, you can easily substitute X for Y.
Kalarm is the KDE alarm tool, which can, besides paying sounds, display a text file, or execute commands at specific times in the future. Even if you are an Ubuntu user (Gnome) you still can install and use kalarm. The name of the package to install is, unsurprisingly, “kalarm”!
Use the Xmms-Alarm plugin:
Xmms is the famous winamp-lookalike minimal music player for Linux. Install the package “xmms-alarm” and then you can use Xmms as an alarm. Downside: you will have to keep xmms running all night. No biggie? Alright then, you are all set. Click on the image above to see how to get to the point where you can set the preferences. (Right click on the Xmms window and Choose Options->Preferences->General Plugins)
Using Xmms and “at”:
Start XMMS and start playing songs. Adjust the volume to what you want to wake up to.
Push the stop button, then type:
$echo xmms -p | at 7:00
The “at” command line utility will make sure xmms starts playing at 7 AM the next day to wake you up.
Read $man at to find out more about “at”, which can do just about anything “at” a particular time.
Use “sleep” and “at” :
$sleep 8h && xmms /path/to/mp3file.mp3
This will open the mp3file.mp3 file with xmms after exactly 8 hours.
Use cron, mplayer, and a few other usual suspects:
More details at The Cron-Mp3 alarm clock writeup.
So , pick your
Finally, if music doesn’t wake you up, the following sure will:
$sleep 8h && cat /dev/urandom > /dev/dsp
Thanks to all the ubuntu-users subscribers for writing in great suggestion, a few months ago.