[Jack-Devel] Some observations re Jack and systemd

Jörn Nettingsmeier nettings at stackingdwarves.net
Sat Dec 22 21:48:21 CET 2018

On 12/21/18 10:08 PM, Chris Caudle wrote:
> On Fri, December 21, 2018 2:24 pm, Jörn Nettingsmeier wrote:
>> Example service file:
>> [Unit]
>> Description=JACK Audio Connection Kit
>> After=sound.target
>> After=ntp.service
>> After=time-sync.target
>> Before=jackd.target
>> Requires=jackd.target
> I assume your service file would be jackd.service, can you explain how the
> requires jackd.target works?  I am familiar with service files, but only
> vaguely have seen target in reference to systemd (mostly in using
> runlevel3.target or runlevel5.target as replacement for old init commands
> to change runlevel).

To be honest, I don't have a full understanding yet. Looking at the 
behaviour of standard targets of the distro has helped me, and there's 
man systemd.special.

The quick summary is this:
A target itself knows nothing and does nothing interesting.

Mine looks like:
Description=jackd sound server target
After=sound.target jackd.service
Requires=sound.target jackd.service

So all it does is it needs other things, _and_ they need to happen 
first, hence the duplication in After= and Requires=.
(It took me a while to understand that for systemd, "Requires=" doesn't 
mean it has to be there when this unit is started, only that it will be 
activated eventually...)

My jackd.target knows it can only become active after the sound.target 
is reached and the jackd.service is active.

The semantics I gleaned from man systemd.special are these:

For a "passive" target like this, only the provider(s) of the necessary 
services should pull it in (in systemd lingo, this means "Requires=" or 
at least "Wants="). In this case, that's jackd.service.
Other services that need jack.target to be reached should not pull it 
in, but only order themselves after it (using "After=").

Jörn Nettingsmeier
Tuinbouwstraat 180, 1097 ZB Amsterdam, Nederland
Tel. +49 177 7937487

Meister für Veranstaltungstechnik (Bühne/Studio), Tonmeister VDT

More information about the Jackaudio mailing list