cyberline/systemd-state

PHP Systemd State Parser

v1.1.0 2019-02-27 13:34 UTC

This package is auto-updated.

Last update: 2024-11-08 08:09:59 UTC


README

Scrutinizer Code Quality Code Coverage Build Status Latest Stable Version Total Downloads Latest Unstable Version License

This package provides an object oriented way to access your systemd service state.

Tested Versions

  • Ubuntu: systemd 229
  • Debian: systemd 215,232
  • CentOS: systemd 219

Usage

composer require cyberline/systemd-state

# get info about systemd itself:
$systemdState = new SystemdState;
$info = $systemdState->getSystemdInfo();
...

# get info about specific services:
$systemdState = new SystemdState;
$systemdState
    ->addCheckUnit('nginx');
    ->addCheckUnit('redis');
$info = $systemdState->getReport();
...

# get info from pregenerated file
# /bin/systemctl show * --no-pager > systemd.txt
$systemdState = new SystemdState;
$info = $systemdState
    ->checkFromString(file_get_contents('systemd.txt'))
    ->getReport();
...

# get info about all services:
$systemdState = new SystemdState;
$systemdState->addAllUnits();
$info = $systemdState->getReport();