Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm currently tinkering with anacron 2.3 on a Ubuntu 12.04 (Precise) installation. I have been trying to make use of the START_HOURS_RANGE and RANDOM_DELAY env vars. My /etc/anacrontab looks like this:

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
START_HOURS_RANGE=3-5
RANDOM_DELAY=30

# These replace cron's entries
1    5    cron.daily     nice run-parts --report /etc/cron.daily
7    10    cron.weekly     nice run-parts --report /etc/cron.weekly
@monthly    15    cron.monthly nice run-parts --report /etc/cron.monthly
1    0    test.job    echo 'TEST JOB'

The thing is, when I manually run anacron using

sudo anacron -s

The test job is executed immediately, even though I'm outside the start time range and there is a random delay associated.

I don't know what else to do to reproduce the behaviour described in the manpage for anacrontab(5)

I already thank you for any help that you could give me.

Goodbye,

Nicolás Carrasco Stevenson

share|improve this question
    
If you see this before me: do a grep START /etc/anacrontab and post the results. If it shows nothing it is not supported on Ubuntu. No idea why it would not though ;) And if it does the manual page is wrong :D –  Rinzwind Jul 5 '13 at 14:59

1 Answer 1

up vote 2 down vote accepted

Ubuntu manpage for anacrontab states:

Environment assignment lines are of the form:

VAR = VALUE

Spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The assignment takes effect from the next line to the end of the file, or to the next assignment of the same variable.

Redhat manpage for anacrontab states:

Environment assignment lines are of the form:

VAR = VALUE

Spaces around VAR are removed. No spaces around VALUE are allowed (unless you want them to be part of the value). The assignment takes effect from the next line to the end of the file, or to the next assignment of the same variable. The enviroment variable START_HOURS_RANGE sets the time frame, when the job could started.

I have a sneaky suspicion that START_HOURS_RANGE is NOT used in Ubuntu. The Ubuntu man page does not mention these parameters. This is a RHEL/CentOS Linux v6.x feature.


Proof is in the pudding:

rinzwind@discworld:~$ grep START /etc/anacrontab
rinzwind@discworld:~$ 

So yes, unsupported on Ubuntu.


Even more pudding!

START_HOURS_RANGE was added in anacron-2.3-68.

Ubuntu 13.04 uses...

$anacron -V 
Anacron 2.3
share|improve this answer
    
Damn, I didn't even noticed the manpages to be different. I just skimmed over them and assumed to be the same behaviour on both distros. If this is case would cross-compiling the CentOS source let me use those variables?? (with the woes from cross-compiling that is) –  Nicolás Carrasco Jul 5 '13 at 15:28
    
@NicolásCarrasco even better: find anacron version 2.3-68+ We use 2.3-19 –  Rinzwind Jul 5 '13 at 17:50
    
Isn't the number after the dash, like "-68", a distribution-specific version number? –  pcworld Sep 4 '13 at 23:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.