# Cron jobs when shutdown? Run at boot?



## michaelsanford (Dec 7, 2003)

I'm sure there's a post on this somewhere, but I couldn't find it.

Obviously I don't leave my Clamshell iBook on all the time. So, what happens to my maintenance cron jobs when my computer's off? Do they run at next boot, or are they not run at all?


----------



## phatcactus (Dec 7, 2003)

They don't run at all.

Google says there are alternative programs that will run jobs at the next boot, like hc-cron, but I haven't the slightest idea as to how to install them.  Perhaps someone with some experience can help...


----------



## Darkshadow (Dec 8, 2003)

You want anacron.  Easiest way to install it is via fink (otherwise, you'll have to track down some libraries that aren't installed on OS X before you can compile it).

Some caveats:
It doesn't run all the time like cron does.  You can set it up to run at boot, and it'll run any jobs that need to run, but then it quits.  The seriously funny thing, straight from anacron's read me file:


> "In addition to running Anacron from the boot-scripts, it is also
> recommended to schedule it as a daily cron-job (usually at an early
> morning hour), so that if the machine is kept running for a night,
> jobs for the next day will still be executed."




You can, of course, run it manually when needed.


----------



## pds (Dec 8, 2003)

Why shut down? 
No real reason as far as I can see, unless you are on safari and have no power outlet. I leave my iBook on constantly. That way it is virtually instantly on when I want it.

So a startup cron doer won't do, but the machine sleeps and then the cron bits don't work either.

o'reilly just had a bit on doing it manually, look here


----------



## bobw (Dec 8, 2003)

Here are some programs you can use to have the jobs run on your time schedule;

http://www.versiontracker.com/php/search.php?mode=basic&action=search&str=cron&plt[]=macosx&x=0&y=0


----------



## michaelsanford (Dec 8, 2003)

pds » my iBook make a lot of noise and I'm a light sleeper, so I have to put it to sleep for me to sleep, so the cron jobs don't run.... I don't mind rebooting in the morning while my coffee brews. Thanks for the article too, very useful.

Thanks for the advice on anacron, I was considering mentioning it, since I had it on my RedHat box, but I thought Apple might have a clever built-in workaround.


----------



## bobw (Dec 8, 2003)

The new Schedule feature in the Panther Energy Saver System Preferences Pane, can now set your machine to automatically turn itself on and off at any given hour. You could use that for the Cron tasks.

You need to alter the crontab so that the tasks ran at 3:15, 3:30, and 3:45 rather than the time spread they are currently set at.

http://www.macosxhints.com/article.php?story=2001020700163714


----------

