[systemd-devel] Antw: Re: Re: [EXT] Re: Q: Querying units for "what provides" a target

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Fri Sep 9 11:12:40 UTC 2022


>>> Michael Biebl <mbiebl at gmail.com> schrieb am 09.09.2022 um 12:54 in
Nachricht
<CAGWsdOg7p8UyUV87RmGxKG9WO0khBhR1SBZ2+E78g=Nr94-MMg at mail.gmail.com>:
> Am Fr., 9. Sept. 2022 um 12:31 Uhr schrieb Michael Biebl
<mbiebl at gmail.com>:
>>
>> Am Fr., 9. Sept. 2022 um 12:08 Uhr schrieb Ulrich Windl
>> <Ulrich.Windl at rz.uni-regensburg.de>:
>> >
>> > >>> Michael Biebl <mbiebl at gmail.com> schrieb am 09.09.2022 um 10:55 in
>> > Nachricht
>> > <CAGWsdOibC4k0CqxubSRKRV3ZU=xPpdeMYGnA8b4sC80hMDbqOg at mail.gmail.com>:
>> > > Example: syslog.service
>> > >
>> > > $ systemctl status syslog.service
>> > > ● rsyslog.service - System Logging Service
>> > >      Loaded: loaded (/lib/systemd/system/rsyslog.service; enabled;
>> > > preset: enabled)
>> > >      Active: active (running) since Thu 2022-09-08 08:55:45 CEST; 1 day
1h
>> > > ago
>> > > TriggeredBy: ● syslog.socket
>> > >        Docs: man:rsyslogd(8)
>> > >              man:rsyslog.conf(5)
>> > >              https://www.rsyslog.com/doc/ 
>> > >    Main PID: 624 (rsyslogd)
>> > >       Tasks: 4 (limit: 19002)
>> > >      Memory: 3.8M
>> > >         CPU: 1.341s
>> > >      CGroup: /system.slice/rsyslog.service
>> > >              └─624 /usr/sbin/rsyslogd -n -iNONE
>> > >
>> > > You'll see that syslog.service is provided by  provided by
>> > > rsyslog.service (and the actual name of the file on the disk)
>> > > Isn't this what you wanted? If not, I must have misunderstood what you
>> > > are looking for.
>> >
>> > Hi!
>> >
>> > I'm afraid that does not help:
>> > # systemctl status time-set.target
>> > ● time-set.target - System Time Set
>> >      Loaded: loaded (/usr/lib/systemd/system/time-set.target; static)
>> >      Active: active since Mon 2022-09-05 14:30:42 CEST; 3 days ago
>> >        Docs: man:systemd.special(7)
>> >
>> > Now what is actually providing "time-set" (if any)?
>> > Does that mean "nothing provides time-set"?
>> >
>> > Likewise:
>> > # systemctl status time-sync.target
>> > ● time-sync.target - System Time Synchronized
>> >      Loaded: loaded (/usr/lib/systemd/system/time-sync.target; static)
>> >      Active: active since Mon 2022-09-05 14:32:00 CEST; 3 days ago
>> >        Docs: man:systemd.special(7)
>> >
>> > Sep 05 14:32:00 host16 systemd[1]: Reached target System Time
Synchronized.
>> >
>> > Clear now?
>>
>> Not really.
>> Are you interested in what services hook into time-sync.target (and
>> are ordered before it)?
> 
> If you are interested in services that pull in e.g. time-sync.target
> via Wants (or Requires) and order themselves before the target, you
> can use something like
> $ systemctl show time-sync.target -p WantedBy -p RequiredBy -p After
> RequiredBy=
> WantedBy=chrony.service
> After=chrony.service time-set.target

It seems what I wanted to know is output by
# systemctl show -p After time-set.target
After=systemd-timesyncd.service
# systemctl show -p After time-sync.target
After=time-set.target ntp-wait.service

However the "After=" is somewhat unexpected. And "-p WantedBy" is definitely
wrong (it will output units that "require the target", not the units "providing
the target").

Regards,
Ulrich




More information about the systemd-devel mailing list