PR #1569 adds preliminary support for systemd which is now present on many Linux systems. This topic is intended to explore continuing to add support for this.
Background: Systemd is a mechanism used to manage various aspects (called units) of modern Linux systems including the services running on them. Units are individually configured and activated based on enabled targets. Targets include but are not limited to the sysvinit runlevels and more.
Units and targets are configured on both a system and per-user basis. Configuration files may reside in one of several locations:
- /etc/systemd/system
- /etc/systemd/user
- /usr/lib/systemd/system
- /usr/lib/systemd/user
- ~/.config/systemd/user/
Systemd configuration may be retrieved by scanning these directories for the appropriate unit and target files and parsing them.
Each unit file may list the targets which it is ‘RequiredBy’ and those which it is ‘WantedBy’. The former is a hard dependency, if a requirement fails to launch / be configured properly then the component which requires it will be deactivated. The later is a softer dependency, if the wanted unit fails to launch, the unit/target which references it will still continue.
Implementation: The current patch scans the directories specified above (minus the user home directories) and extracts service units into the existing MiQ service xml structure. The enable/disable run_level fields are not currently populated as the required / wanted by model does not fit into this.
To resolve this the system_services table could be expanded with new ‘required_by’ and ‘wanted_by’ columns to store this information in and the corresponding service screen updated to display this information.
Thoughts? Alternate solutions?