I am writing a service monitoring application that should know when services go from active to inactive / inactive.
I subscribe to the signal PropertiesChangedand watch ActiveState. but this is not enough. When the service stops using kill/systemctl stop, I see that I change the signal twice ActiveState=deactivating: one with Substate="stop-sigterm", and the other with Substate="stop-post".
According to my previous requests, I understand that the ActiveStateAPI is only considered, and we should not look in SubState. but I do not receive ActiveState=inactivewhen the service is stopped.
So this seems to be a mistake.
In the case of a workaround, is there any way to find out when the service is stopped? As a workaround, should I watch SubState?
https://github.com/systemd/systemd/issues/3807
source
share