You are not logged in.

#1 2016-07-18 09:31:31

Lesmana
Member
Registered: 2015-05-04
Posts: 18

[SOLVED] systemd timer override oncalendar weekly stays daily

I want to configure the pkgfile database update to run weekly instead of daily.

I have enabled the pkgfile database update timer as described in the wiki: https://wiki.archlinux.org/index.php/Pk … ic_updates

$ sudo systemctl enable pkgfile-update.timer

Also start the timer:

$ sudo systemctl start pkgfile-update.timer

Verify that the timer is running

$ systemctl list-timers pkgfile*
NEXT                         LEFT     LAST                         PASSED       UNIT                 ACTIVATES
Di 2016-07-19 00:00:00 CEST  13h left Mo 2016-07-18 09:03:14 CEST  1h 53min ago pkgfile-update.timer pkgfile-update.service

Note the timestamps. Last run today. Next run tomorrow.

I edited the unit file as described in the wiki: https://wiki.archlinux.org/index.php/Sy … p-in_files

$ sudo systemctl edit pkgfile-update.timer

It created an override unit file:

/etc/systemd/system/pkgfile-update.timer.d/override.conf

Content of file:

[Timer]
OnCalendar=weekly

Verify that override is recognized:

$ systemctl status pkgfile-update.timer
● pkgfile-update.timer - pkgfile database update timer
   Loaded: loaded (/usr/lib/systemd/system/pkgfile-update.timer; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/pkgfile-update.timer.d
           └─override.conf
   Active: active (waiting) since Mo 2016-07-18 10:51:35 CEST; 32min ago

Jul 18 10:51:35 lestop systemd[1]: Started pkgfile database update timer.

Verify that timer is now weekly:

$ systemctl list-timers pkgfile*
NEXT                         LEFT     LAST                         PASSED       UNIT                 ACTIVATES
Di 2016-07-19 00:00:00 CEST  12h left Mo 2016-07-18 09:03:14 CEST  2h 19min ago pkgfile-update.timer pkgfile-update.service

It is not weekly. It is still daily.

If I change the override to hourly

[Timer]
OnCalendar=hourly

It will run hourly

$ systemctl list-timers pkgfile*
NEXT                         LEFT       LAST                         PASSED  UNIT                 ACTIVATES
Mo 2016-07-18 12:00:00 CEST  32min left Mo 2016-07-18 11:26:51 CEST  55s ago pkgfile-update.timer pkgfile-update.service

But if I set it to weekly or monthly or yearly it will still run daily.

What am I missing? How can I set it to weekly?

Last edited by Lesmana (2016-07-18 12:01:46)

Offline

#2 2016-07-18 10:32:43

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: [SOLVED] systemd timer override oncalendar weekly stays daily

Timers are cumulative, so in the override you need to reset the existing timers otherwise your OnCalendar setting gets added to the existing one.

[timer]
OnCalendar=
OnCalendar=weekly

Offline

#3 2016-07-18 11:47:49

Lesmana
Member
Registered: 2015-05-04
Posts: 18

Re: [SOLVED] systemd timer override oncalendar weekly stays daily

Thank you. That solved my problem. Now the timer runs weekly.

Offline

Board footer

Powered by FluxBB