Easy cron question

  • Follow


Let's say I have a job at 13:00 but the system is down. If it comes up
at 13:30, does it run the job it missed or do I have to wait till next
cycle ?????
0
Reply unixzip (36) 12/16/2009 3:55:35 PM

unix wrote:
> Let's say I have a job at 13:00 but the system is down. If it comes up
> at 13:30, does it run the job it missed or do I have to wait till next
> cycle ?????

You need to wait.  Cron wakes up each minute it is
running, checks for jobs whose time specification
matches "now", runs them, and goes back to sleep.
If cron isn't running at 13:00 then those jobs
don't get run.  (Cron attempts to do the right thing
for daylight savings time and clock skew adjustments.)

BSD provides "periodic" and Gnu/Linux provides "anacron".
These facilities are run by cron, but record a timestamp
for the last time the job was run.  The format of the
jobs is different too, you don't provide a time
specification but an "interval" (in days or longer).
If periodic/anacron sees it has been "interval" days
or longer since the job was last run, it will run it now.

I think periodic/anacron was designed for home user systems
that get turned off each night.  I believe Solaris has an
equivalent facility, but if not it would be easy to script one.
Just create a directory /etc/daily and have a script that
is run by cron (say) hourly.  It runs each executable in that
directory if it has been more than a day since it was last
run.  You can keep the timestamps under /var someplace.
(Actually this sounds like a good project for a shell
scripting course.)

-- 
Wayne
0
Reply Wayne 12/16/2009 4:32:03 PM


In article <767334c1-16fe-4e2d-984b-f854bc6c93bb@e20g2000vbb.googlegroups.com>,
unix  <unixzip@yahoo.com> wrote:
>Let's say I have a job at 13:00 but the system is down. If it comes up
>at 13:30, does it run the job it missed or do I have to wait till next
>cycle ?????

The job won't run until the next time the computer clock is at the 
time(s) specified in crontabs.  Cron only understand "now," once a
minute, so if cron was not running at the time the job should have
been started, cron won't to anyghing.  

Habk
0
Reply hankvc 12/17/2009 6:08:23 AM

2 Replies
224 Views

(page loaded in 0.16 seconds)

Similiar Articles:













7/20/2012 7:11:48 PM


Reply: