Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

mjanser/php-systemctl

Repository files navigation

SystemCtl for PHP

Build Status Code Coverage

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);

About

PHP library for managing services with systemctl

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages