Add systemctl enable/disable
This commit is contained in:
parent
2a0ee67582
commit
06b5ec3e71
8
woven.py
8
woven.py
|
@ -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() }
|
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():
|
for id, c in cs.items():
|
||||||
print(f"stopping tunnels for {id}...", end = " ", flush = True)
|
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; done")
|
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("done")
|
||||||
print(f"removing existing configs for {id}...", end = " ", flush = True)
|
print(f"removing existing configs for {id}...", end = " ", flush = True)
|
||||||
try:
|
try:
|
||||||
|
@ -241,8 +241,8 @@ class WovenConfig:
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
for id, c in cs.items():
|
for id, c in cs.items():
|
||||||
print(f"starting tunnels for {id}...", end = " ", flush = True)
|
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; done")
|
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")
|
print("done")
|
||||||
|
|
||||||
def format_exception(exc: BaseException, type: type | None) -> str:
|
def format_exception(exc: BaseException, type: type | None) -> str:
|
||||||
|
|
Loading…
Reference in New Issue