You are not logged in.

#1 2014-05-17 06:56:12

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Systemd timer rules

Hello,
I'm going to replace cronie with systemd timers, but for my knowledge I stumble upon the way to prepare a rule that should run on every 20 minutes from midnight to 9:00 AM every days.

the crontab would be something like

*/20 0-9 * * *   root myjob
Any example ?


do it good first, it will be faster than do it twice the saint wink

Offline

#2 2014-05-17 09:13:05

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Systemd timer rules

"To stumble upon something" means to (accidentally) discover it, which would mean you now have the knowledge. But if you want to figure out how to specify timer events for this job, that's pretty straightforward.

  • Read `man systemd.timer`.

  • Learn that you should use OnCalendar and that the syntax for calendar events is explained in systemd.time(7).

  • Check `man systemd.time` to learn about calendar events (includes examples, but don't skip the syntax description).

If you still get stuck, you'll at least have put in some effort and you can report back here.

Offline

#3 2014-05-17 11:15:09

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Systemd timer rules

I think OP wanted to say 'stumble over' i.e. trip over, to have problems with, not 'stumble upon'.

See also https://wiki.archlinux.org/index.php/Sy … ctionality for some examples.

Offline

#4 2014-05-17 12:50:43

TheSaint
Member
From: my computer
Registered: 2007-08-19
Posts: 1,523

Re: Systemd timer rules

OK, English still a steep learning curve sad
Thanks both for the attention, unfortunately I didn't find a clear explanation for both reading, that I've done before posting.

Am I right, if I'll set like this?

[Unit]
Description=foo timer

[Timer]
#           Y-M-D HH:MM:SS
OnCalendar= *-*-* 0-9:00,20,40:00
#     range also permitted ?
Persistent=true
Unit=foo.service

[Install]
WantedBy=basic.target

Will it run every 20 minutes from 00:00 to 00:90 ?


do it good first, it will be faster than do it twice the saint wink

Offline

#5 2014-05-17 13:27:13

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

Re: Systemd timer rules

You can't use a “-” range for hours, only “,”.
I suggest you put two OnCalendar entries:

# midnight to 8:40am
OnCalendar=0,1,2,3,4,5,6,7,8:0/20
# and lastly at 9am
OnCalendar=9:0

Offline

Board footer

Powered by FluxBB