On Sat, Apr 12, 2025 at 02:26:44PM +0000, Holger Levsen wrote:
> I'm also wondering how to both ship the crontab entries for systems not
> running systemd while at the same preventing dual runs via systemd timer
> and cron. I'd appreciate pointers or insight on this!

ISTM the canonical way is exiting the cron job, like this:

% head -n 13 /etc/cron.daily/apt-compat
#!/bin/sh

set -e

# Systemd systems use a systemd timer unit which is preferable to
# run. We want to randomize the apt update and unattended-upgrade
# runs as much as possible to avoid hitting the mirrors all at the
# same time. The systemd time is better at this than the fixed
# cron.daily time
if [ -d /run/systemd/system ]; then
    exit 0
fi


Chris

Reply via email to