Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for systemd-timer #214

Closed
vrandr opened this issue Sep 19, 2023 · 0 comments · Fixed by #216
Closed

Add support for systemd-timer #214

vrandr opened this issue Sep 19, 2023 · 0 comments · Fixed by #216

Comments

@vrandr
Copy link

vrandr commented Sep 19, 2023

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.26.0
  • Ruby: 2.7.0p0
  • Distribution: Ubuntu 20.04+, Debian 11+
  • Module version: v7.0.0

How to reproduce (e.g Puppet code you use)

class { '::logrotate':
  manage_cron_daily  => true,
  ensure_cron_daily  => 'present',
  manage_cron_hourly => true,
  ensure_cron_hourly => 'present',
}

What are you seeing

On Ubuntu 20.04+ and at least Debian 11+ the logrotate package ships a systemd-timer unit which takes presence over the configured cronjob.

$cron_daily_hour and $cron_daily_minute will be ignored.

What behaviour did you expect instead

  • Module manages systemd-timer unit or
  • systemd-timer gets disabled

Output log

$ uname -a
Linux host.fqdn 5.15.0-1044-aws #49~20.04.1-Ubuntu SMP Mon Aug 21 17:09:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ systemctl list-timers logrotate.timer
NEXT                         LEFT     LAST                         PASSED  UNIT            ACTIVATES
Wed 2023-09-20 00:00:00 CEST 13h left Tue 2023-09-19 00:00:01 CEST 10h ago logrotate.timer logrotate.service

1 timers listed.
Pass --all to see loaded but inactive timers, too.

$ systemctl cat logrotate.timer
# /lib/systemd/system/logrotate.timer
[Unit]
Description=Daily rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)

[Timer]
OnCalendar=daily
AccuracySec=12h
Persistent=true

[Install]
WantedBy=timers.target

Any additional information you'd like to impart

Disabling the timer unit can be archived with:

systemd::timer { 'logrotate.timer':
  active => false,
  enable => 'mask',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants