Add systemctl enable/disable

This commit is contained in:
LilyRose2798 2024-05-09 20:54:12 +10:00
parent 2a0ee67582
commit 06b5ec3e71
1 changed files with 4 additions and 4 deletions

View File

@ -132,8 +132,8 @@ class WovenConfig:
cs = { id: Connection(f"{node.address}", user = "root", config = ssh_config) for id, node in self.mesh_nodes.items() }
for id, c in cs.items():
print(f"stopping tunnels for {id}...", end = " ", flush = True)
c.run(f"for f in {self.wireguard_config_glob}; do systemctl stop wg-quick@$(basename $f .{self.wireguard_config_ext}).service; done")
print(f"stopping and disabling tunnels for {id}...", end = " ", flush = True)
c.run(f"for f in {self.wireguard_config_glob}; do systemctl stop wg-quick@$(basename $f .{self.wireguard_config_ext}).service && systemctl disable wg-quick@$(basename $f .{self.wireguard_config_ext}).service; done")
print("done")
print(f"removing existing configs for {id}...", end = " ", flush = True)
try:
@ -241,8 +241,8 @@ class WovenConfig:
print("done")
for id, c in cs.items():
print(f"starting tunnels for {id}...", end = " ", flush = True)
c.run(f"for f in {self.wireguard_config_glob}; do systemctl start wg-quick@$(basename $f .{self.wireguard_config_ext}).service; done")
print(f"starting and enabling tunnels for {id}...", end = " ", flush = True)
c.run(f"for f in {self.wireguard_config_glob}; do systemctl start wg-quick@$(basename $f .{self.wireguard_config_ext}).service && systemctl enable wg-quick@$(basename $f .{self.wireguard_config_ext}).service; done")
print("done")
def format_exception(exc: BaseException, type: type | None) -> str: