You are not logged in.

#1 2016-05-18 15:39:29

leonarddr
Member
Registered: 2013-03-27
Posts: 6

Systemd timer convensions

Dear users,

I noticed that multiple convensions are used for timer targets. For example, the Logrotate, shadow and pkgstats timers are placed into multi-user.target, whereas systemd uses timers.target for timers such as systemd-tmpfiles-clean.timer. Which of the two targets should be used for custom timers? Shouldn't all timers be set to timers.target?

Kind regards,
Leonard

Offline

#2 2016-05-19 05:01:03

useradded
Member
From: Edinburgh, UK
Registered: 2010-05-15
Posts: 77

Re: Systemd timer convensions

I've used timers.target for my custom timers, as that seemed to make sense. The various tutorials I've seen seem split between that and other targets. I also use calibre-installer from the AUR, which uses multi-user.target: https://aur.archlinux.org/packages/calibre-installer.

Offline

#3 2016-05-19 05:50:48

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Systemd timer convensions

Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2016-05-19 15:25:55

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Systemd timer convensions

useradded wrote:

I also use calibre-installer from the AUR, which uses multi-user.target: https://aur.archlinux.org/packages/calibre-installer.

I probably saw one of those other tutorials, then. big_smile

AFAIK it shouldn't really make a difference, multi-user.target is activated whenever the system is ready to accept logins and timers.target is pulled in by basic.target which means it starts slightly... before?
Unless you are doing something important while setting up the system, I don't *think* it matters, though given that I simply copy-pasted what I saw other people doing, I wouldn't take my words as gospel truth...

EDIT: And obviously, it is terribly unclean to do the wrong thing just because "it doesn't really make a difference".

Last edited by eschwartz (2016-05-19 19:38:33)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2016-05-19 17:29:27

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

Re: Systemd timer convensions

I would simply follow the upstream recommendation to use timers.target unless you have a good reason not to. The use of multi-user.target probably persists/spreads through copy-paste.

And the man page says that unless DefaultDependencies= is set to false, a timer unit will implicitly have a dependency Before=timers.target.

Offline

#6 2016-05-20 12:30:09

useradded
Member
From: Edinburgh, UK
Registered: 2010-05-15
Posts: 77

Re: Systemd timer convensions

Eschwartz wrote:

I probably saw one of those other tutorials, then. big_smile

A much appreciated script, regardless of target.

Offline

#7 2016-05-20 12:43:45

lastchancetosee
Member
From: Berlin
Registered: 2009-02-19
Posts: 131

Re: Systemd timer convensions

Expanding on Eschwartz' answer, see here for an overview of what gets started when.

Upstream recommends using timer.target. As for Arch, there has been some discussion on the mailing list a while back on whether or not to follow that recommendation (I don't know if a decision has been made).

I'd say, if you think your timed service should only be available on a fully booted system, use multi-user.target (you probably have to mess with DefaultDependencies). If you want it to be started as soon as the basic boot process is finished, use timers.target. if you don't care, follow upstream (i.e. use timers.target).


My ship don't crash! She crashes, you crashed her!

Offline

Board footer

Powered by FluxBB