Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Easy cron question

0 views
Skip to first unread message

unix

unread,
Dec 16, 2009, 10:55:35 AM12/16/09
to
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 ?????

Wayne

unread,
Dec 16, 2009, 11:32:03 AM12/16/09
to

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

HankVC

unread,
Dec 17, 2009, 1:08:23 AM12/17/09
to
In article <767334c1-16fe-4e2d...@e20g2000vbb.googlegroups.com>,

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 new messages