Commit 306b4f5c authored by pa's avatar pa 🌊 Committed by root
Browse files

Dont restart service if it is not already running

parent a3bf0b77
......@@ -99,5 +99,5 @@ if __name__ == "__main__":
else:
with open(os.path.join(path, 'generated', f"dhcp.{extension}.list"), 'w') as generated:
generated.write(template.render(machines=machines, extension=extension))
if not args.do_not_regen:
if not args.do_not_regen and subprocess.run(['/usr/bin/systemctl', 'is-active', '--quiet', 'isc-dhcp-server']).returncode == 0:
subprocess.run(['/usr/bin/systemctl', 'restart', 'isc-dhcp-server'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment