Services Status

hi everyone,
i would like to ask how can i pole the status of some services to see if they are active or not?
What i have done is that i have created an thing with the exec binding with the command
/bin/systemctl status paradox.service
and an item that is linked to an output channel as string. What i get is
● paradox.service - Paradox Connection Loaded: loaded (/lib/systemd/system/paradox.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2019-11-20 21:48:39 EET; 12h ago Main PID: 18739 (python3) Tasks: 3 (limit: 4915) CGroup: /system.slice/paradox.service └─18739 /usr/bin/python3 -u /etc/pai/run.py
How i can filter all of this and just get the active (running) to appear on my UI?
Is there any other way?
TIA

You might be able to use the techniques that Rich talks about in this thread to split the big String into usable parts.

1 Like

If the service opens and listens to a port, using the Network Binding would be less work.

To filter the result of the call to systemctl, just use a REGEX expression.

Something like .*Active: (.*) since.* should work.

1 Like

Thanks rlkoshak the Regex expression worked like a charm!!!