Skip to content

Commit c09f332

Browse files
committed
Update README
1 parent f61d1a9 commit c09f332

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ PHP wrapper for systemctl (PHP7.1)
1212
- [::setTimeout(int $timeout)](#settimeoutint-timeout)
1313
- [::setInstallPath(string $installPath)](#setinstallpathstring-installpath)
1414
- [::setAssetPath(string $assetPath)](#setassetpathstring-assetpath)
15-
- ["I need sudo to run commands"](#i-need-sudo-to-run-commands)
16-
- [How do I start/stop/restart a unit?](#how-do-i-startstoprestart-a-unit)
15+
- ["I need sudo to run commands"](#i-need-sudo-to-run-commands)
1716
- [Managing units](#managing-units)
1817
- [Supported units](#supported-units)
1918
- [Handling unit commands](#handling-unit-commands)
@@ -53,23 +52,10 @@ The `default` path is relative to the `SystemCtl` vendor package
5352
SystemCtl::setAssetPath('assets');
5453
```
5554

56-
## "I need sudo to run commands"
55+
# "I need sudo to run commands"
5756
If you need sudo, you should execute the bin executable with sudo.
5857
The incode support was dropped due to security reason.
5958

60-
## How do I start/stop/restart a unit?
61-
Simply is that. First we instantiate a `SystemCtl` instance an load a unit from a specific type.
62-
Here we use a `Service`. You will always get back `true` if the command succeeded.
63-
Otherwise the method will throw a `CommandFailedException`.
64-
65-
```php
66-
$systemCtl = new SystemCtl();
67-
68-
// start/stop/enable/disable/reload/restart
69-
$systemCtl->getService('nginx')->start();
70-
$systemCtl->getService('nginx')->stop();
71-
```
72-
7359
# Managing units
7460
To manage any unit u want simply use the proper getter to receive an `Unit` object from `SystemCtl`
7561

@@ -93,6 +79,12 @@ Available unit commands are:
9379
- isEnabled
9480
- isActive
9581

82+
```php
83+
$systemCtl = new SystemCtl();
84+
85+
$systemCtl->getService('nginx')->start();
86+
```
87+
9688
# Install new units
9789

9890
> To see a full documentation on how unit files are structure see [Redhat Systemd Documentation](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html)

0 commit comments

Comments
 (0)