diff --git a/bin/sau b/bin/sau index 383d385..426bee2 100755 --- a/bin/sau +++ b/bin/sau @@ -48,7 +48,7 @@ def fork_and_reboot(): log = logging.getLogger(sau.LOGNAME) if os.path.exist('/proc/1/comm'): with open('/proc/1/comm', 'r') as f: - if f.readline() == 'systemd': + if f.readline().strip() == 'systemd': os.execl('/usr/bin/systemctl', 'reboot') log.error("Failed to execl?") sys.exit(1) diff --git a/sau/gentoo.py b/sau/gentoo.py index f1b8fe7..e77d52e 100644 --- a/sau/gentoo.py +++ b/sau/gentoo.py @@ -22,7 +22,7 @@ def identify_service_from_bin(exe): log = logging.getLogger(sau.LOGNAME) with open('/proc/1/comm', 'r') as f: - if f.readline() == 'systemd': + if f.readline().strip() == 'systemd': init_script_re = re.compile(r'[^/]*(.*)\.service$') else: init_script_re = re.compile(r'/etc/init\.d/(.*)') @@ -61,7 +61,7 @@ def identify_service_from_bin(exe): def restart_service(service): log = logging.getLogger(sau.LOGNAME) with open('/proc/1/comm', 'r') as f: - if f.readline() == 'systemd': + if f.readline().strip() == 'systemd': cmd = [ SYSTEMCTL, 'restart', service ] else: cmd = [ RC_SERVICE_PATH, service, 'restart' ]