Package: anacron
Version: 2.3-29

Steps to reproduce:

# create user job for anacron
echo '1 60 myJob /usr/bin/touch /tmp/$(date + "% T")_from_anacron'> 
/tmp/anacrontab

# put tomorrow's timestamp for that job
echo "$(date -d tomorrow + '%Y%m%d')"> /tmp/myJob

# launch user anacron with given timestamp
anacron -n -t /tmp/anacrontab -S /tmp

The file in /tmp is created immediately, instead it should not be created until 
tomorrow,
if anacron respects the timestamp.

I see that it was an explicit choice and not a semantic error:
...
    6    Changes in Anacron 2.1/2.2
    7    --------------------------
    8 * Sean 'Shaleh' Perry <shaleh@(debian.org|valinux.com)> is now maintainer
    9 * if timestamp is from the future, re-run job
   10 * ansi cleanup / code cleaning
...

and yet I would still like to show why it is useful to change this behavior.
Imagine using an anacrontab with period 1 to run a script that does something
as soon as an independent event occurs.
This event (say an email) occurs rarely, say every three months, but with no 
exact schedule.
Imagine that only in that case the script completes its task and,
before exiting, overwrites the anacron timestamp with one that postpones
its execution for about three months.
So far, so good.
Unfortunately as soon as anacron is run again, the job is still run and anacron
overwrites the timestamp with the current one, regardless of its date.
This means that the script would still run for three months every single day
for no reason.

It would be nice instead if, in evaluating the timestamp,
anacron did a test like this:

if <today> is greater than or equal to <current timestamp> + <period>:
    run the job and update the timestamp
else:
    do not do nothing


tl;dr: my feature request is to make anacron not execute the job if <current 
timestamp> is a date in the future compared to <today>

with regard
Raimondo Giammanco

Reply via email to