Context: Linux "systemd" machine; CFE 3.18.
We have an emerging use case to run a specific, minimal (i.e. fast) subset of our cf-agent policy during machine shutdown/halt. We are considering a "systemd" service with something like:
ExecStop=cf-agent….
Is there something already in place which can tell us the current state (target?) of systemd? Perhaps a "var" (e.g. "sys.") in CFE? Or perhaps something in "/proc" or similar that our policy could peek at?
There aren't any system variables that hold states of systemd units and I am not familiar with anything in proc that indicates a systemd unit state.
bundle agent systemd_services
which is used to manage systemd service state parses information returned by systemctl --no-ask-password --global --system -pLoadState,CanStop,UnitFileState,ActiveState,LoadState,CanStart,CanReload show <service>
Failing that, we do could something like:
ExecStop=cf-agent … -D HALTING
Seems like a reasonable thing to try.