diff options
author | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2021-08-09 09:55:11 +0000 |
---|---|---|
committer | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2021-08-09 09:55:11 +0000 |
commit | c3d536f77d62da7c37406dd831dae8d22cb9bd1a (patch) | |
tree | f2ed0113ec0f001a0edaaf336c4bdd87d3c13ba5 /python | |
parent | 92db99f8e21b0dc0965b544a3a88e82bbea26eaa (diff) | |
download | vyos-1x-c3d536f77d62da7c37406dd831dae8d22cb9bd1a.tar.gz vyos-1x-c3d536f77d62da7c37406dd831dae8d22cb9bd1a.zip |
openconnect: T3695: Add systemd service checker on commit
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py index be7c53438..28f0c9bd1 100644 --- a/python/vyos/util.py +++ b/python/vyos/util.py @@ -702,3 +702,9 @@ def get_interface_config(interface): from json import loads tmp = loads(cmd(f'ip -d -j link show {interface}'))[0] return tmp + +def is_systemd_service_running(service): + """ Test is a specified systemd service is actually running. + Returns True if service is running, false otherwise. """ + tmp = run(f'systemctl is-active --quiet {service}') + return bool((tmp == 0)) |