Add new information methods (isActiveRaw
, isEnabledRaw
and show
)
#26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds three new methods to help get additional information about services. We are aiming to use this library to display information about several services on a web dashboard, with the potential management of these being a secondary concern.
To this end, I've added some additional info methods:
isActiveRaw()
: retrieve the raw string output of theis-active
command. We need this as we use some 'oneshot' services, which can be 'inactive' (as opposed to failed) under normal circumstances. Simply checking them to see if they are 'active', as the normalisActive()
method does, is not enough for us: we need to raw response from thesystemctl
command.isEnabledRaw()
: retrieve the raw string output of theis-active
command. We don't strictly need the output of this but I added it for completeness.show()
: retrieve the raw string output of theshow
command but parsing it to an array. We need some more detailed information like the time a 'oneshot' last ran, and potentially theExecStart
line to see the command actually run for debugging. This method takes the (extensive) output of theshow
command and makes it available to be easily consumed via a correctly keyed array of the output of the command.Happy to make changes to the above to better conform with your library. I just quickly added these methods so we could access this additional systemd information.