Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use Automator and crontab to create an alarm clock Apps
As I went to bed last night, it was stormy out, and my power went out four times before I actually left my desk. My video game time thoroughly interrupted, I wanted to be sure that I was going to wake up in time for work in the morning. There are plenty of shareware and freeware alarm clock programs out there, but as far as I know, none will work if the computer restarts after a power failure.

You can probably do this trick alone with iCal, but I wanted to find a solution without setting up a multitude of calendar events, and I don't know iCal as well as I should. So I created an Automator application to 'Get specified iTunes items' and then 'Start iTunes Playing' (both in the iTunes library entry). I picked a playlist created with a few songs to be somewhat obnoxious, so that I'd actually wake up, walk over, and turn off the computer. I saved the workflow as an application and stuck it in ~/Applications/.

Then, I went to the Terminal, and elected to edit the crontab (via crontab -e). I added this line:
0 6 * * 1-5 open ~/Applications/alarmclock.app
Just make sure that you've enabled 'Restart automatically after a power failure' on the Options tab of the Energy Saver system preferences panel. Incidentally, about 10 minutes after I finally went to bed, the power went out again. It didn't come back on while I was awake, but I woke up on time.

It took me about 20 minutes to download and test a handful of alarm clocks, and it took me about 10 minutes to come up with this solution. I have been teaching myself Perl, and I know there's gotta be a way to make a more robust alarm clock, but this was as quick as I could do at 12:30am.
    •    
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[15,333 views]  

Use Automator and crontab to create an alarm clock | 8 comments | Create New Account
Click here to return to the 'Use Automator and crontab to create an alarm clock' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Automator and crontab to create an alarm clock
Authored by: aigujin on Nov 14, '05 08:55:00AM

Nice tip but how would you set the time to wake up? Is it possible to set a different time at different days?



[ Reply to This | # ]
Use Automator and crontab to create an alarm clock
Authored by: jacobolus on Nov 14, '05 09:37:40AM

Can someone set this up using launchd, and post it?



[ Reply to This | # ]
Launchd GUI
Authored by: lullabud on Nov 14, '05 10:08:15AM
http://lingon.sourceforge.net/

Just saw this posted today on AFP548 and it looks like it'd help out anybody wanting to port this cron trick to launchd.

[ Reply to This | # ]
Use Automator and crontab to create an alarm clock
Authored by: jacobolus on Nov 14, '05 09:40:58AM

All the shareware alarm clock apps I've seen stay open all the time. The silly thing is, launching processes on a schedule is something cron, launchd are very good at, so this design makes little sense. It would be really slick if someone made an alarm clock preference pane. Actually, sounds like a fun project for some rainy afternoon.



[ Reply to This | # ]
Use Automator and crontab to create an alarm clock
Authored by: CajunLuke on Nov 14, '05 10:32:46AM

Fob is a good timer program, and it continues working through restarts and whatnot.



[ Reply to This | # ]
Use Automator and crontab to create an alarm clock
Authored by: Scripter12 on Nov 14, '05 12:50:05PM

Why not use iCal? Simply set an alarm that says you want to launch a script at a certain time. Then write a simple script that tells iTunes to play a playlist. iCal doesn't even have to be running for this to work. It is easier to set times in iCal and you have the option of repeating alarms. I've found this to be very reliable which is a key thing for an alarm clock.

tell application "iTunes"
play playlist "Wakeup"
end tell



[ Reply to This | # ]
Use Automator and crontab to create an alarm clock
Authored by: keaka on Nov 14, '05 01:21:03PM
All the shareware alarm clock apps I've seen stay open all the time. ... It would be really slick if someone made an alarm clock preference pane.
PowerController is an alarm clock preference pane, and doesn't have any app taking dock space:
http://keakaj.com/powercontroller.htm
as far as I know, none will work if the computer restarts after a power failure.
PowerController works if your computer restarts after a power failure (assuming you have your account set to automatically log you in).

Disclaimer: I'm the author of PowerController.

---

Sanity Software: http://keakaj.com/

[ Reply to This | # ]

Doing it iCal style
Authored by: gaoshan on Nov 14, '05 01:47:01PM

In iCal, set up an event at whatever time you want the alarm to start.
In the Info drawer (if you can't see it click the i button at bottom right, select "Show Info" from the View menu or press Command-I) where it says "Alarm" click and select "Open file". From the pull down menu under "Open file" select "Other..." and pick a song/sound/recording whatever. Under that select when, exactly, you want the file to start. You are good to go (unless your machine is asleep when the time comes. Gotta keep it awake all night. This is why alarm programs are better than using iCal).




[ Reply to This | # ]