Wake Mac from sleep to run script in crontab

I wrote my own backup script and run it via root's crontab. It is a simple find -newer command piped into a tar command. Nothing flashy like Time Machine. No GUI.

Currently it looks like I need to stay logged in all the time with X11 running for crontab to work. Can I get around this somehow?

Ideally I would prefer the Mac to wake up from sleeping and run my backups nightly.

iMac 20, Mac OS X (10.5.1)

Posted on Dec 5, 2007 6:57 PM

Reply
7 replies

Dec 5, 2007 11:25 PM in response to Hawaiian Scuba Dude

You don't need to be logged in from cron entries to work, but the machine can't be asleep.

If it's asleep, no processes are running, including cron, so it can't fire off your script.

Your best option is to use Energy Saver to wake your machine a few minutes before you want the backup to run. Your script can sleep the machine when it's finished.

An alternative that might work would be at. From memory, when the machine wakes, at will invoke scripts that should have run when the machine was asleep.

Dec 6, 2007 6:19 AM in response to Hawaiian Scuba Dude

Long time since I posted here. For my macs, I installed anacron from Fink - it will run the 1/day, 1/week, etc. scripts anytime it is awake. Works like cron, but its for those scripts that you don't care when they run during the day.

I also moved the cron.daily scripts to run under anacron so the admin clean-ups always get run.

Now my G5 and my wife's iBook both get regular backups and I can worry about one thing less. You can read about it at http://www.macosxhints.com/article.php?story=20031111110802488

Boyd

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Wake Mac from sleep to run script in crontab

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.