Rich Mintz (richmintz.com seems empty) gave me a great tip for keeping focused. He’s a Mac user and OS X makes it easy to get the computer to say the time every 15 minutes. It isn’t so easy on Ubuntu, but it is doable. Since I put this in place, I’ve found that it does help me focus more. It can also help keep me from working too late (not that it has yet). Anyway, here is the bit of magic that you need:
(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|espeak --stdout|sox -q -V0 -t wav - -t alsa pulse")|crontab -
(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|padsp espeak")|crontab -
will also work, but you may get emails filled with error messages from cron. Breaking it down
(crontab -l; ...) | crontab -
This part dumps the current crontab out, appends the new line (elided here, see the next step) and then, with the “
crontab -” after the pipe, creates an entirely new crontab with the results. This way, we just add a new cronjob to the list of ones you may already have.
echo "0,15,30,45 * * * * ..."
The first part of any crontab file gives a schedule for execution. Since I just want this to run every 15 minutes, I haven’t set up anything besides that, but you could tell it “only during business hours during the work week” which might look something like “
0,15,30,45 9-17 * * 1-5“. I recommend you RTFM for help on that, though.
(echo it is now;date \+\%I:\%M\%p )
Print out two lines that are what you’ll hear. If you don’t want to hear “It is now”, then you can leave out that echo statement and the parenthesis. The date command just formats the current time in HH:MM AM/PM time format. One problem is that at the top of the hour you have “00” which the synthesizer reads as “zero zero”. Oh well, all is not perfect.
| espeak --stdout
Every 15 minutes when the cron job is run, espeak reads the bit from date and produces a wav file with the sounds that your computer should play. Normally, espeak would just play this out on your speakers, but you might be listening to music. If the speakers were otherwise engaged (by, say, Rhythmbox), then you won’t hear the sound and cron will send you an email full of strange error messages.
| sox -q -V0 -t wav - -t alsa pulse
To get the sound to mix properly with other sound apps, it has to play out through pulseaudio (the new, default sound server in Hardy). Strangely enough, even though pulseaudio was supposed to Fix the Linux audio mess once and for all, we still have to jump through hoops.
There is a chance that saytime will just work for you. But, because of that “audio mess” that still exists in Ubuntu, it didn’t work for me.