[mythtv-users] Ubuntu 18.04.1 LTS do-release-upgrade with Mythtv

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Oct 23 07:51:26 UTC 2018


On Mon, 08 Oct 2018 04:37:36 +1300, you wrote:

>12) anacron seems to be running the daily cron jobs at a different
>time - about an hour earlier than it used to.  I have changed the
>/etc/crontab settings back to the old times, but I will have to wait
>until tomorrow to see if that fixes it.  The old times were normally a
>time when I do not have any recordings happening, or only one
>recording.  Having the cron jobs run earlier was a problem as the
>system could be too busy at the time and have recordings fail due to
>the huge overheads on the database when it is checked and backed up by
>anacron.

An update on the anacron problem: The problem I was having was caused
by anacron being run every hour from a new systemd unit:

/lib/systemd/system/anacron.timer

It resulted in the anacron jobs normally being run shortly after
midnight, which is often a very busy recording time for me an quite
unsuitable.

I consider this to be a bug - anacron is not designed to be run every
hour.  It is supposed to be run at startup (which now happens from the
anacron.service unit), and also once a day, so it can do daily, weekly
and monthly cron jobs.  Hourly cron jobs are run from cron, not
anacron, but it looks like whoever was responsible for creating
anacron.timer did not understand that.  The fix I came up with is to
override the anacron.timer file to cause anacron to only be run once a
day after 07:30, as used to happen.  To do that, I created a systemd
override file:

root at mypvr:/etc/systemd/system/anacron.timer.d# cat
anacron-timer-override.conf
[Unit]
Description=Trigger anacron at 07:30, as happened before the Ubuntu
18.04 upgrade.

[Timer]
OnCalendar=
OnCalendar=07:30
RandomizedDelaySec=0s
Persistent=true

When anacron runs, it looks at its /etc/anacrontab file and executes
things from there as necessary:

root at mypvr:/etc# cat anacrontab
# /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
HOME=/root
LOGNAME=root

# These replace cron's entries
1       5       cron.daily      run-parts --report /etc/cron.daily
7       10      cron.weekly     run-parts --report /etc/cron.weekly
@monthly        15      cron.monthly    run-parts --report
/etc/cron.monthly

The anacrontab file looks like a crontab file but does not work the
same.  The "1 5" setting means run once daily, at 5 minutes after
anacron has been started.  The "7 10" setting means run every 7 days,
10 minutes after anacron has been started.  Anacron runs things in
sequence, so if the cron.daily tasks run beyond the time the
cron.weekly tasks are scheduled for, anacron will wait until the
cron.daily tasks finish before starting the cron.weekly tasks.  See
"man anacrontab".

I have reported this to the package maintainer.


More information about the mythtv-users mailing list