mjanser / systemctl
Library for managing systemd services using systemctl
Installs: 656
Dependents: 1
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 3
Open Issues: 1
pkg:composer/mjanser/systemctl
Requires
- php: >=7.1
- symfony/process: ^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.0
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2021-01-26 14:13:07 UTC
README
This library can be used to manage systemd services.
Internally it uses the Symfony Process Component for running the systemctl
command.
Requirements
- PHP 7.0 or higher
systemd
installed
Installation
Run the following composer command in your project:
composer require mjanser/systemctl
Usage
Example usage:
$service = new SystemCtl\Service('my-service'); if ($service->isRunning()) { $service->stop(); } else { $service->start(); } $service->restart();
By default the command systemctl
will be executed with sudo
. You can change that if you need.
SystemCtl\Service::setCommand('my-systemctl'); SystemCtl\Service::sudo(false);