Skip to content

Commit dea2965

Browse files
author
Andreas Frömer
committed
2 parents fa4391b + 90bfd9b commit dea2965

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ Don't worry. Simply set sudo flag to `true`.
3232
SystemCtl::sudo(true);
3333
```
3434

35+
## How do I start/stop/restart a unit?
36+
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`.
37+
38+
```php
39+
$systemCtl = new SystemCtl();
40+
41+
// start/stop/enable/disable/reload/restart
42+
$systemCtl->getService('nginx')->start();
43+
$systemCtl->getService('nginx')->stop();
44+
```
45+
3546
# How to Contribute
3647
Simply clone the repo and install using `composer`
3748

0 commit comments

Comments
 (0)