Notice that the cron package is not installed by default in Debian 12 bookworm, so a systemd .timer unit will make acng maintenance script working even in minimal configuration.

I think, the approach used by apt is applicable to apt-cacher-ng as well: /lib/systemd/system/apt-daily.timer and /lib/systemd/system/apt-daily.service files for systemd and /etc/cron.daily/apt-compat has the following check

if [ -d /run/systemd/system ]; then
    exit 0
fi

Both the .service unit and the cron job execute /usr/lib/apt/apt.systemd.daily helper.

On Sun, 13 Aug 2023 16:41:57 +0200 Alexandre Detiste wrote:
but fails when run through systemd-cron.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1040304

> Could not make a valid request to the server.
> Please visit
> 
http://UNIX-DOMAIN-SOCKET/acng-report.html?doExpire=Start+Expiration&abortOnErrors=aOe
> and check special conditions.

I do not see the issue with pure systemd timer.

May it happen that apt-cacher-ng process was not running for some reason when the maintenance task was started? Another hypothesis is that generated systemd unit is running in so strict isolation that network is unavailable to it.

Check Protect*, Private* and similar properties in the output of

  systemctl show cron-daily-apt-cacher-ng.service
  systemctl cat cron-daily-apt-cacher-ng.service

Reply via email to