You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-["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)
17
16
-[Managing units](#managing-units)
18
17
-[Supported units](#supported-units)
19
18
-[Handling unit commands](#handling-unit-commands)
@@ -53,23 +52,10 @@ The `default` path is relative to the `SystemCtl` vendor package
53
52
SystemCtl::setAssetPath('assets');
54
53
```
55
54
56
-
##"I need sudo to run commands"
55
+
# "I need sudo to run commands"
57
56
If you need sudo, you should execute the bin executable with sudo.
58
57
The incode support was dropped due to security reason.
59
58
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
-
73
59
# Managing units
74
60
To manage any unit u want simply use the proper getter to receive an `Unit` object from `SystemCtl`
75
61
@@ -93,6 +79,12 @@ Available unit commands are:
93
79
- isEnabled
94
80
- isActive
95
81
82
+
```php
83
+
$systemCtl = new SystemCtl();
84
+
85
+
$systemCtl->getService('nginx')->start();
86
+
```
87
+
96
88
# Install new units
97
89
98
90
> 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