You are not logged in.

#1 2010-04-04 23:57:41

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

[solved] cron's do not happen so I put cron restart in rc.local OK?

Is there a better way to do this?

I noticed my cron.hourly only runs if cron is asked to restart at some point, so I added:

/etc/rc.d/crond restart

to /etc/rc.local

Does this make sense?

(the result is that at boot cron is asked to restart and so consequently the crons are run)

Last edited by tawan (2010-04-05 01:57:41)

Offline

#2 2010-04-05 01:57:26

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

well, I'll mark as solved as it seems to work.

I'm still curious if this is the best way though...

Offline

#3 2010-04-05 03:12:17

fumbles
Member
Registered: 2006-12-22
Posts: 246

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

This might be silly but: Have you put crond in /etc/rc.conf ?

Offline

#4 2010-04-05 03:22:27

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

hahaha (at myself)

silly, yes.

no, I had not big_smile

Offline

#5 2010-04-05 10:32:33

RufusD
Member
Registered: 2010-03-21
Posts: 86

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

for desktop computers it's more advisable to use anacron instead of cron. Imagine having cronjobs set to 2am. In case your PC is always switched off at 2am, these never get executed. anacron checks for skipped cronjobs when powering on your PC and executes them. cron basically only makes sense for machines running 24/7.
IIRC anacron picks up all the cronjobs defined in cron's configuration files, so switchin from cron involves no configuring afterwards

Offline

#6 2010-04-05 10:42:35

Pierre
Developer
From: Bonn
Registered: 2004-07-05
Posts: 1,964
Website

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

our new dcron does this as well; so no need for anacron.

Offline

#7 2010-04-05 17:22:02

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

Pierre wrote:

our new dcron does this as well; so no need for anacron.

Yes that's right. However there are some bugs at the moment so @hourly and @daily jobs don't always run at the frequency they're supposed to. Just writing to say I'm aware of this and will fix as soon as I can squeeze some development time into an already-busy schedule.

Offline

#8 2010-04-06 12:36:14

RufusD
Member
Registered: 2010-03-21
Posts: 86

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

what's the advantage of dcron as compared to anacron? I don't mean to be stubborn, just curious

Offline

#9 2010-04-06 12:42:27

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

dcron is a lightweight cron daemon with the anacron functionality (plus a bit more) rolled in.

Advantages: only one syntax to keep track of, only one set of files to configure, only one program to track bugs against, also there's someone here to listen to bug reports / feature requests (anacron development stopped at least five years ago).

On the other hand, if you've got an existing anacron setup that works for you, no need to break what you've got.

Offline

#10 2010-04-06 14:09:05

RufusD
Member
Registered: 2010-03-21
Posts: 86

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

I thought anacron features the same advantages 1 to 3. Didn't know anacron is obsoleted, though. Thanks for the advice, so I'll stay clear of anacron

Offline

#11 2010-04-06 14:35:30

Profjim
Member
From: NYC
Registered: 2008-03-24
Posts: 658

Re: [solved] cron's do not happen so I put cron restart in rc.local OK?

Well, if your scripts only need to run every N days, then you could set cron up to run anacron and do all the configuration in anacron. If you have any scripts that run at different frequencies, for example every hour, then you'd need to mess with crontabs as well.

Anacron isn't broken. But it isn't being developed, and I got no response when I sent a patch (a feature-enhancement) to the developers a year or two ago. (I don't remember whether I even was able to find a working email address...)

Offline

Board footer

Powered by FluxBB