All Projects → icanhazstring → Systemctl Php

icanhazstring / Systemctl Php

Licence: mit
PHP wrapper for systemctl

Projects that are alternatives of or similar to Systemctl Php

Kubernetes Cheatsheet
This is Kubernetes Cheatsheet based on Kubernetes API 1.19 version.
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Fosoauthserverbundle
A server side OAuth2 Bundle for Symfony
Stars: ✭ 1,068 (+1877.78%)
Mutual labels:  hacktoberfest
Nestjs Redoc
📘 ReDoc frontend for you NestJS swagger API documentation
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Knigge
An opinionated way of dealing with behaviours
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Dbbench
🏋️ dbbench is a simple database benchmarking tool which supports several databases and own scripts
Stars: ✭ 52 (-3.7%)
Mutual labels:  hacktoberfest
Druid Exporter
A Golang based exporter captures druid API related metrics and receives druid-emitting HTTP JSON data.
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
React Emoji Search
🦄 A simple emoji search tool made with ReactJS.
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Laravel Janitor
🔑 Easily add login proxy to your Laravel API
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Ripple Without Js
Create Material Design ripple effect in your HTML without using a single line of JS.
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Rescript React Navigation
ReScript bindings for React Navigation
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Thm Discord Bot
TryHackMe Python Bot
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Wombat
Flat file headless CMS for building configurable API
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Sanity Typed Queries
A typed, zero-dependency schema generator and query builder for Sanity.
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Geeksforgeeks Dsa 2
This repository contains all the assignments and practice questions solved during the Data Structures and Algorithms course in C++ taught by the Geeks For Geeks team.
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Gg
A tool to manage multiple git repositories
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Java
Repository for Java codes and algos.Star the repo too.
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Vue Social Sharing
A renderless Vue.js component for sharing links to social networks, compatible with SSR
Stars: ✭ 1,071 (+1883.33%)
Mutual labels:  hacktoberfest
Aws Iot Device Sdk Cpp V2
Next generation AWS IoT Client SDK for C++ using the AWS Common Runtime
Stars: ✭ 53 (-1.85%)
Mutual labels:  hacktoberfest
Awesome Emoji Picker
Add-on/WebExtension that provides a modern emoji picker that you can use to find and copy/insert emoji into the active web page.
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest
Animoji
Describe your favorite anime with emoji ✨
Stars: ✭ 54 (+0%)
Mutual labels:  hacktoberfest

systemctl-php

CI Pipeline Code Climate Test Coverage Join the chat at https://gitter.im/icanhazstring/systemctl-php

PHP wrapper for systemctl

How to install

$ composer require icanhazstring/systemctl-php

Current supported units

See Units

If you like to add support for more units, feel free to grab an issue and contribute.

Current supported commands

  • start
  • stop
  • enable
  • disable
  • reload
  • restart
  • isEnabled
  • isActive

If you like to add support for more commands, feel free to contribute.

How to change the binary

SystemCtl::setBinary('/bin/systemctl');

How to change command timeout

To change command tmeout simply call the static method setTimeout.

SystemCtl::setTimeout(10);

The default timeout is set to 3 seconds

"I need sudo to run commands"

If you need sudo, you should execute the bin executable with sudo. The incode support was dropped due to security reason.

How do I start/stop/restart a unit?

Simply is that. First we instantiate a SystemCtl instance an load a unit from a specific type. Here we use a Service. You will always get back true if the command succeeded. Otherwise the method will throw a CommandFailedException.

$systemCtl = new SystemCtl();

// start/stop/enable/disable/reload/restart
$systemCtl->getService('nginx')->start();
$systemCtl->getService('nginx')->stop();

How to Contribute

Clone the repo and install using composer

$ composer install

Make your changes and make sure you run test and codesniffer.

$ composer test
> vendor/bin/phpunit tests/
PHPUnit 6.1.4 by Sebastian Bergmann and contributors.

........                                                            8 / 8 (100%)

Time: 130 ms, Memory: 2.00MB

OK (8 tests, 13 assertions)

$ composer cs
> vendor/bin/phpcs --standard=PSR2 src/ && vendor/bin/phpcs --standard=PSR2 tests/

$

Credits

This library is heavily influenced by @mjanser php-systemctl.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].