icanhazstring/systemctl-php

systemctl status support

jpleau opened this issue · 2 comments

Hi.

Would it be possible to add a status command, so we can check if a service is currently running, or is enabled?

Thanks

Hi @jpleau

You can already to that, by invoking one of the following methods on the unit:
isActive(), isRunning(), isEnabled()

To retrieve a unit use the following:

$systemCtl = new SystemCtl();
$systemCtl->getService('nginx')->isRunning();

Sorry for the inconvenience. The docs are a bit out of date on current master :)

I should have looked at the code, it was right there !

Thanks