From 5c13ff35ce5f8255f805dcb96e7777e2c5aa8c9e Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Tue, 2 Apr 2019 00:18:51 +0100 Subject: [PATCH] check command result --- home.admin/config.scripts/internet.sshtunnel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/internet.sshtunnel.py b/home.admin/config.scripts/internet.sshtunnel.py index b595240..021ebb1 100755 --- a/home.admin/config.scripts/internet.sshtunnel.py +++ b/home.admin/config.scripts/internet.sshtunnel.py @@ -16,9 +16,9 @@ if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help": if sys.argv[1] == "on": # check if already running -> systemctl is-enabled autossh-tunnel.service - alreadyRunning = subprocess.check_output('systemctl is-enabled autossh-tunnel.service' ,shell=True) + alreadyRunning = subprocess.check_output('systemctl is-enabled autossh-tunnel.service' ,shell=True, universal_newlines=True) print(alreadyRunning) - if alreadyRunning == "enabled": + if str(alreadyRunning).count("enabled") > 0: print("already running - run 'internet.sshtunnel.py off' first") sys.exit(1)