diff options
author | Daniil Baturin <daniil@vyos.io> | 2021-08-09 17:16:30 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 17:16:30 +0700 |
commit | 8709e3561f1d2ecdd3f98c86f2ed744313780ffa (patch) | |
tree | f2ed0113ec0f001a0edaaf336c4bdd87d3c13ba5 /python/vyos | |
parent | 92db99f8e21b0dc0965b544a3a88e82bbea26eaa (diff) | |
parent | c3d536f77d62da7c37406dd831dae8d22cb9bd1a (diff) | |
download | vyos-1x-8709e3561f1d2ecdd3f98c86f2ed744313780ffa.tar.gz vyos-1x-8709e3561f1d2ecdd3f98c86f2ed744313780ffa.zip |
Merge pull request #957 from DmitriyEshenko/1x-equuleus-09082021
openconnect: T3695: Add systemd service checker on commit
Diffstat (limited to 'python/vyos')
-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)) |