mjanser/systemctl

This package is abandoned and no longer maintained. The author suggests using the icanhazstring/systemctl-php package instead.

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

dev-master 2018-02-11 17:40 UTC

This package is auto-updated.

Last update: 2021-01-26 14:13:07 UTC


README

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