You are not logged in.

#1 2018-11-16 12:08:52

argwella
Member
Registered: 2016-12-14
Posts: 2

anacron doesn't do anything

Hello,

I have a script (let's call it test.sh) that is correctly executed by cron at
scheduled hours every day. It runs on a machine that is not on 24/h. Therefore,
I'd like anacron to run it at boot time when there was a miss. 

From what I understand, i have to put the script in /etc/cron.daily, which I did.
My /etc/anacrontab is the default one.

Nothing happens at the next boot when the cron job was missed.

If i do
# anacron -f -n

to force immediate execution, nothing happens either. Entries are written in journalctl :
JJob `cron.daily' started
Job `cron.daily' terminated

but the script test.sh is not executed.
Also, when I run
# anacron -T
nothing is displayed (from the man page, I should have either 0 or 1 depending on whether
the /etc/anacrontab file is valid).

Any idea ?

Many thanks

Offline

#2 2018-11-16 14:55:44

Haller
Member
Registered: 2018-04-08
Posts: 45

Re: anacron doesn't do anything

I cannot help you with anacron, but you could use systemd instead. I think that's the Arch way, nowadays.
https://wiki.archlinux.org/index.php/Systemd/Timers

Offline

#3 2018-11-16 16:38:48

argwella
Member
Registered: 2016-12-14
Posts: 2

Re: anacron doesn't do anything

Haller wrote:

I cannot help you with anacron, but you could use systemd instead. I think that's the Arch way, nowadays.
https://wiki.archlinux.org/index.php/Systemd/Timers

Well, thank you for the suggestion. Indeed, it is sounder to do it with a service and a timer (launched daily).
Besides, I find it easier to run it with user permissions this way (must be doable with anacron too but seems less straightforward).

So I think I will drop anacron (and cron) completely on a machine that is not always on.

Offline

Board footer

Powered by FluxBB