Skip to content

Commit

Permalink
Check if systemd is currently running (Fixes #118)
Browse files Browse the repository at this point in the history
Rather than just checking if systemctl binary is installed,
verify that systemd is currently running as init.
  • Loading branch information
Valentin Vidic authored and Valentin Vidic committed Aug 25, 2017
1 parent 5f1c7a2 commit fbfe34f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pcs/lib/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,12 @@ def is_systemctl():
Check whenever is local system running on systemd.
Returns True if current system is systemctl compatible, False otherwise.
"""
systemctl_paths = [
'/usr/bin/systemctl',
'/bin/systemctl',
'/var/run/systemd/system',
systemd_paths = [
'/run/systemd/system',
'/var/run/systemd/system',
]
for path in systemctl_paths:
if os.path.exists(path):
for path in systemd_paths:
if os.path.isdir(path):
return True
return False

Expand Down

0 comments on commit fbfe34f

Please sign in to comment.