PHP code example of pupax / systemd-wrapper
1. Go to this page and download the library: Download pupax/systemd-wrapper library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pupax / systemd-wrapper example snippets
$wrapper = new \Pupax\SystemdWrapper();
$wrapper->start('nginx'); // Start nginx service
$wrapper->stop('nginx'); // Stop nginx service
$wrapper->restart('nginx'); // Restart nginx
$wrapper->reload('nginx'); // Reload nginx
$timers = $wrapper->listTimers(); // Get SystemD timers
$sockets = $wrapper->listSockets(); // Get SystemD sockets
$units = $wrapper->listUnits(); // Get SystemD units
$systemInfo = $wrapper->show(); // Get SystemD infos
$unitInfo = $wrapper->show('nginx'); // Get nginx info