Skip to content

SystemD timers

Hey. I set up a systemD timer for a service that is activated from Monday to Friday at 09:00. It is not set to run on weekend days, but I have set the “persistent” option to true, so if I power up the machine after that time, the service is executed asap.

Quick question: if I don’t power up the machine at all on Friday, but I do on Saturday, will the timer start the application?

5 points6 comments
Open on Reddit
About this post
Posted
Archived
Score
5 · 74% up
Kind
Text
ID
kxsin5

Author

42
posts
411
comments
23
media
View profile

7 comments

Are these easier than cronjobs?

4 points

No. You have to create both a timer file and possibly a service file. Then the timer needs to started and enabled.

But timers are more powerful, flexible and consistent with the rest of systemd, so I prefer them.

3 points

IMO yes they are easier than cronjobs, and have much more advanced features like being able to tell if the timer should have ran when the computer was off built into the system, and massively higher accuracy for timers than what cron is capable of. Cron is limited to 60 seconds afaik, where systemd timers can have microsecond accuracy. It also has a lot more features as well, but those are some cool ones I figured would be worth mentioning.

2 points
unknown author

Deleted before we saved it.

1 points

They are harder if you want to "run this executable on a timer without duplicate detection, proper logging, automatic restarts and everything else". Implementing any of these in cronjob is a major PITA, but just a line in systemd service/timer file.

1 points

From the description in the documentation, I would expect so. It just checks if the timer would have run while the system was off, not whether it would run anyway that day.

4 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.