[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about using anacron with cron



> > I have a question about cron and anancron.
> >
> > After reading the man page for both cron/crontab and anacron/
> > anacrontab, it's not clear to me how to configure for the following:
> >
> > --jobs to run currently live in /etc/crontab
> > --jobs need to run serially (hence the staggered start times in
> > crontab)
> >
> > As I understand it, anacron will only run those jobs created as
> > scripts in the **ly folders (e.g. /etc/cron.weekly).

not only, you can run a script from anywhere by editing /etc/anacrontab (see 
man anacrontab)

> >
> > So, my question is this: if I have periodic jobs to run in /etc/
> > crontab, how do I have anacron run those jobs when cron fails to do so
> > (e.g. machine turned off)?

use cron _or_ anacron, not both!

> > It seems to me that the only way anacron will do what I expect it to
> > do is to move my jobs in /etc/crontab into /etc/cron.daily. Yet, if I
> > do that, I lose the ability to have jobs run serially (or at least run
> > the risk of having jobs overlap each other).

jobs in /etc/cron.daily are run one by one in lexicographic order, so you just 
have to prepend their name with a number (01first_script, 02second_script...) 
to order them (see man run-parts)

>
> I can't answer your cron/anacron questions directly, but why not just
> wrap your cron jobs in a script that runs them sequentially? then you
> can just run that script from cron/anacron and not worry about it.
>

seems to be a good solution too

-- 
Cédric Lucantis



Reply to: