You are not logged in.

#1 2024-09-11 15:43:07

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 245
Website

[SOLVED] systemd timer drop-in file doesn't work

I set up an automatic snapshot mechanism with yabsnap.
I want to change the default .timer file. The default .timer file  proposes this frequency: OnCalendar=*-*-* *:30:00. I want to change to one weekly snapshot only. Thus I wrote this drop-in file :

/etc/systemd/system/yabsnap.timer.d/yabsnap-weekly.conf
OnCalendar=Mon *_*_* 02:00:00

But it looks like my file doesn't work, as reported by the command:

$ systemctl list-timers
Wed 2024-09-11 17:30:14 CEST 1min 58s Wed 2024-09-11 16:30:24 CEST 57min ago yabsnap.timer                    yabsnap.service

We can see the timer doesn't take into account my new settings.
What am I doing wrong? I stop/started the timer and ran

systemctl daemon-reload

Last edited by gabx (2024-09-15 16:04:37)

Offline

#2 2024-09-11 16:27:32

merlock
Member
Registered: 2018-10-30
Posts: 262

Re: [SOLVED] systemd timer drop-in file doesn't work

Change your drop in to:

OnCalendar=
OnCalendar=Mon *_*_* 02:00:00

Eenie meenie, chili beanie, the spirits are about to speak -- Bullwinkle J. Moose
It's a big club...and you ain't in it -- George Carlin
Registered Linux user #149839
perl -e 'print$i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); '

Offline

#3 2024-09-11 18:16:55

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 245
Website

Re: [SOLVED] systemd timer drop-in file doesn't work

Looks like it doesn't change anything:

$ cat /etc/systemd/system/yabsnap.timer.d/yabsnap-weekly.conf
# each monday at 2:00 AM
OnCalendar=
OnCalendar=Mon *_*_* 02:00:00
-------
$ systemctl list-timers
Thu 2024-09-12 00:00:00 CEST 3h 45min Wed 2024-09-11 00:00:09 CEST            - shadow.timer                     shadow.service

Offline

#4 2024-09-11 20:25:28

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,813

Re: [SOLVED] systemd timer drop-in file doesn't work

You need to use the [Timer] section Header.
Sometimes it's necessary to First assigne the key to No value to clear IT before re-assigning it.

Offline

#5 2024-09-12 17:37:42

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 245
Website

Re: [SOLVED] systemd timer drop-in file doesn't work

$ cat /etc/systemd/system/yabsnap.timer.d/yabsnap-weekly.conf 
[Timer]
OnCalendar=
OnCalendar=Mon *_*_* 02:00:00
$ systemctl list-timers
  -                                   - Thu 2024-09-12 19:33:52 CEST 1min 58s ago yabsnap.timer                    yabsnap.service

Adding the header section, [Timer], will indeed achieve what I am looking for.

Offline

#6 2024-09-15 15:59:31

gabx
Member
From: Geneva, Switzerland
Registered: 2011-11-20
Posts: 245
Website

Re: [SOLVED] systemd timer drop-in file doesn't work

error

Last edited by gabx (2024-09-15 16:05:37)

Offline

#7 2024-09-15 16:08:55

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,813

Re: [SOLVED] systemd timer drop-in file doesn't work

Does removing the drop-in actually solved that problem? What does the yabsnap.timer look like? Did you update the package (though I'm not sure it's even coming from there - there doesn't seem to be a timer in the upstream github)

Offline

Board footer

Powered by FluxBB