Generic Health Check Framework for systemd
On Fedora Silverblue, IoT or Atomic Host:
rpm-ostree install greenboot greenboot-status greenboot-ostree-grub2 systemctl reboot
Place shell scripts representing health checks that MUST NOT FAIL in the
Place shell scripts representing health checks that MAY FAIL in the
Place shell scripts you want to run after a boot has been declared successful in
Place shell scripts you want to run after a boot has been declared failed in
Unless greenboot is enabled by default in your distribution, enable it by running
systemctl enable greenboot greenboot-healthcheck greenboot-status.
It will automatically start during the next boot process and run its checks.
ssh into the machine after that, a boot status message will be shown.
/etc └── greenboot ├── check │ ├── required.d │ └── wanted.d ├── green.d └── red.d
Overall boot success is measured against
Ordering of units can be achieved using standard systemd vocabulary.
Create a oneshot health check service unit that MUST NOT FAIL, e.g.
systemctl enable required-check to enable it.
[Unit] Description=Custom Required Health Check Before=boot-complete.target [Service] Type=oneshot ExecStart=/usr/libexec/mytestsuite/required-check [Install] RequiredBy=boot-complete.target
Create a oneshot health check service unit that MAY FAIL, e.g.
systemctl enable wanted-check to enable it.
[Unit] Description=Custom Wanted Health Check Before=boot-complete.target [Service] Type=oneshot ExecStart=/usr/libexec/mytestsuite/wanted-check [Install] RequiredBy=boot-complete.target