Coder Social home page Coder Social logo

greenboot's Introduction

greenboot

Generic Health Check Framework for systemd

Installation

On Fedora Silverblue, Fedora IoT or Fedora CoreOS:

rpm-ostree install greenboot greenboot-status greenboot-ostree-grub2

systemctl reboot

Usage

Place shell scripts representing health checks that MUST NOT FAIL in the /etc/greenboot/check/required.d directory. Place shell scripts representing health checks that MAY FAIL in the /etc/greenboot/check/wanted.d directory. Place shell scripts you want to run after a boot has been declared successful in /etc/greenboot/green.d. Place shell scripts you want to run after a boot has been declared failed in /etc/greenboot/red.d.

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.

When you ssh into the machine after that, a boot status message will be shown.

Directory structure:

/etc
└── greenboot
    ├── check
    │   ├── required.d
    │   └── wanted.d
    ├── green.d
    └── red.d

Health Checks with systemd services

Overall boot success is measured against boot-complete.target. Ordering of units can be achieved using standard systemd vocabulary.

Required Checks

Create a oneshot health check service unit that MUST NOT FAIL, e.g. /etc/systemd/system/required-check.service. Run systemctl enable required-check to enable it.

[Unit]
Description=Custom Required Health Check
Before=boot-complete.target
OnFailure=redboot.target
OnFailureJobMode=fail

[Service]
Type=oneshot
ExecStart=/usr/libexec/mytestsuite/required-check

[Install]
RequiredBy=boot-complete.target
WantedBy=multi-user.target

Wanted Checks

Create a oneshot health check service unit that MAY FAIL, e.g. /etc/systemd/system/wanted-check.service. Run 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]
WantedBy=boot-complete.target
WantedBy=multi-user.target

greenboot's People

Contributors

gicmo avatar lorbuschris avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.