I have 2 systemd services.
a.service b.service
b depends on a but I don't want to explicitly mention the dependency in b.service file. Instead I am waiting on the org.freedesktop.DBus.Properties.PropertiesChanged signal from a.service when it starts at boot-up in the code of b.c and poll until I get that signal for it to become active.
sd_ret = sd_bus_match_signal
(
bus,
NULL,
DESTINATION,
A_PATH,
INTERFACE,
"PropertiesChanged",
sd_callback,
NULL
);
And then use poll to wait on signal from dbusfd.
I did the following experiment:
Experiment 1:
STEP 1:
systemctl mask a.service
systemctl mask b.service
STEP 2: reboot
STEP 3:
systemctl unmask a.service
systemctl unmask b.service
STEP 4: run the 'b' binary
./b
STEP 4:
systemctl start a.service
Observation:
b.service is able to catch the signal:
Signal match triggered! destination=(null) interface=org.freedesktop.DBus.Properties member=PropertiesChanged path=/org/freedesktop/systemd1/unit/a2eservice
Starting to poll
Signal match triggered! destination=(null) interface=org.freedesktop.DBus.Properties member=PropertiesChanged path=/org/freedesktop/systemd1/unit/a_2eservice
Property name: ActiveState
Updated ActiveState: active
a Service is now active.
But in Experiment 2
Both service unmasked during boot-up.
At boot-up the a.service does not seem to emit the PropertiesChanged signal.
So wanted to know if the behavior of a service is same during boot-up and after boot-up and does a service send PropertiesChanged signal during boot-up ?