This package provides an object oriented way to access your systemd service state.
- Ubuntu: systemd 229
- Debian: systemd 215,232
- CentOS: systemd 219
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();