Why is my weekly anacron job not executed?

Solution 1:

You didn't post the actual name of the script you are trying tun run, but chances are it contains a dot ('.'), like if it is ending in '.sh'.

run-parts will not run scripts which contain anything else but alphanumerical characters or hyphens. Remove the dot and you are fine.

Solution 2:

When does anacron run

Usually anacron does not run as a daemon. On Debian based systems it runs with classic cron at /etc/cron.d/anacron. It also starts after a system startup, resume from sleep and changing power management state.

You can check the date when anacron job was last run with sudo cat /var/spool/anacron/cron.weekly.

Solution 3:

cat /etc/cron.d/anacron

will show you the hour and day when anachron will run, for example:

# /etc/cron.d/anacron: crontab entries for the anacron package

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

30 7    * * *   root    start -q anacron || :

shows you it will run every morning at 7:30 am but only once a week. It checks the date written in

sudo cat /var/spool/anacron/cron.weekly

(If the date is older, It will start and update the date in that file)