From 77c0cc85ecfcd9301e0104de7cb17812c3f45128 Mon Sep 17 00:00:00 2001 From: Mike Gerber Date: Fri, 26 Jun 2015 20:40:07 +0200 Subject: [PATCH] Support Debian's /bin/systemctl location --- check_systemd_state | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/check_systemd_state b/check_systemd_state index 041b421..11a5e2f 100755 --- a/check_systemd_state +++ b/check_systemd_state @@ -6,9 +6,16 @@ import posixpath import subprocess import sys -systemctl = '/usr/bin/systemctl' -if not posixpath.exists(systemctl): +def find_systemctl(): + systemctls = [ '/bin/systemctl', '/usr/bin/systemctl' ] + for systemctl in systemctls: + if posixpath.exists(systemctl): + return systemctl + + +systemctl = find_systemctl() +if not systemctl: print('System WARN: systemctl not found') sys.exit(1)