mirror of
https://github.com/clearlinux/clearstack.git
synced 2026-06-16 02:55:58 +00:00
Add function to check status of a given systemd service.
Returns 'active', 'failed' or 'inactive' strings, depending of the systemd service status Signed-off-by: Simental Magana, Marcos <marcos.simental.magana@intel.com>
This commit is contained in:
@@ -59,6 +59,12 @@ def port_open(port):
|
||||
return (sck.connect_ex(('127.0.0.1', port)) == 0)
|
||||
|
||||
|
||||
def service_status(service):
|
||||
"""Return status of a given systemd service."""
|
||||
stdout, stderr = run_command("systemctl is-active " + str(service))
|
||||
return (stdout.strip().decode("utf-8"))
|
||||
|
||||
|
||||
def setup_debugging(debug, is_remote_host=True):
|
||||
if not os.path.isdir(LOG_DIR):
|
||||
os.makedirs(LOG_DIR)
|
||||
|
||||
Reference in New Issue
Block a user