>>> Andrei Borzenkov <arvidjaar@xxxxxxxxx> schrieb am 09.09.2022 um 13:41 in Nachricht <CAA91j0VQADw8g5mmoFUOvy=YLF666Z_Y9uqYDgTfnmhSBne3rw@xxxxxxxxxxxxxx>: > On Fri, Sep 9, 2022 at 2:13 PM Ulrich Windl > <Ulrich.Windl@xxxxxxxxxxxxxxxxxxxx> wrote: > ... >> > >> > 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. > > This is exactly what targets are about. The only usage for targets is > to wait until something else becomes active and to do it they must > come After something. > >> And "-p WantedBy" is definitely >> wrong (it will output units that "require the target", not the units > "providing >> the target"). >> > > There is no such thing as "units providing the target". Systemd > documentation makes distinction between targets that Want other units > ("active") and targets that are WantedBy other units ("passive"). It > is expected that services "providing" passive targets have > WantedBy=this-passive.target, otherwise passive targets will not be > activated at all. So WantedBy is exactly correct in this case. Hi! But when I include it (as suggested) I get: # systemctl show -p WantedBy -p RequiredBy -p After time-sync.target RequiredBy= WantedBy=iotwatch@ROOT.service iotwatch@VPM.service iotwatch-generator.service ntp-wait.service systemd-timesyncd.service After=time-set.target ntp-wait.service --- Those iotwatch* units use "Before="; so is the WantedBy= incorrect for those? Those units use: Wants=nss-user-lookup.target time-sync.target paths.target After=nss-user-lookup.target time-sync.target paths.target Regards, Ulrich