LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   What does cron do if machine is down when job is scheduled? (https://www.linuxquestions.org/questions/linux-software-2/what-does-cron-do-if-machine-is-down-when-job-is-scheduled-356483/)

Utah 08-24-2005 09:03 AM

What does cron do if machine is down when job is scheduled?
 
Hi,

Does cron keep track of jobs that didn't get run because the machine was down for some reason when the job was scheduled to run and then run those jobs when the machine is back up again?

And, if not, how do sys admins deal with important jobs that might get forgotten if there was an unscheduled shutdown over the time when the job was scheduled?

Thanks,

Mike Jewell

klatch 08-24-2005 09:16 AM

I use Fedora Core 1 for my home server. That does indeed run cron jobs that should have run while the machine is down.

If for example you have a daily backup, but shut the machine down while you are on holiday for a week the daily will run ONCE when you power the machine back up. For some reason mine waits 64 odd minutes to run the cron job though.

Robert

swede 08-24-2005 09:21 AM

anacron

trickykid 08-24-2005 09:21 AM

Re: What does cron do if machine is down when job is scheduled?
 
Quote:

Originally posted by Utah
Hi,

Does cron keep track of jobs that didn't get run because the machine was down for some reason when the job was scheduled to run and then run those jobs when the machine is back up again?

And, if not, how do sys admins deal with important jobs that might get forgotten if there was an unscheduled shutdown over the time when the job was scheduled?

Thanks,

Mike Jewell

Depends on the distribution or admin, if they have something in place to run cron jobs that were missed.

A good sysadmin should know if a machine is down and it has cron jobs, once he brings it backup to run whatever needs to be run. Some put monitors in place, I'm sure others will run them manually. If your the admin, you decide what's best for you.

Utah 08-24-2005 07:23 PM

Thanks for the suggestions. Using anacron seems like it might make lots of sense. I need to read the man pages a few more times...

For now, I came up with a little hack for my one and only cron job (to send a monthly email to an address to check that forwarding is still being done). I just added another cron job that runs every day at noon (when my machine is almost always up) and checks if the logfile from the first (mailing) cron job is older than, say, 31 days. If so, then that job must not have run on schedule so it runs it now. This would not be a good solution in general but for my simple case, it gets the job done. (so to speak...) 8^)

Utah

Mike Jewell
One-Up Audio


All times are GMT -5. The time now is 07:53 PM.