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

Michael Biebl mbiebl at gmail.com
Fri Sep 9 10:54:37 UTC 2022


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


More information about the systemd-devel mailing list