#!/usr/bin/python import os import re import lib.helpers as helpers from subprocess import check_output hubic_available = helpers.is_exe('/usr/bin/hubic') if not hubic_available: print('Not running') os.exit(1) return_value = check_output(['hubic', 'status']) m = re.search(r'State: (.*)', return_value.decode("utf-8")) print(m.group(1))