Development

This commit is contained in:
Matthew Grotke 2026-06-09 15:49:07 -04:00
parent 836f4557f2
commit 46afed7965
2 changed files with 19 additions and 7 deletions

View file

@ -6,7 +6,9 @@ and accumulates lifetime totals in a JSON file.
"""
import json
import os
import re
import signal
import subprocess
import time
from datetime import datetime
@ -42,14 +44,13 @@ def collect_metrics(data):
any_running = False
for vlan in data["vlans"]:
svc = shared.vlan_service_name(vlan, validation.derive_interface(vlan, data))
result = subprocess.run(
["systemctl", "kill", "--signal=SIGUSR1", svc],
capture_output=True, text=True
)
if result.returncode != 0:
pid_file = shared.vlan_pid_file(vlan)
try:
pid = int(pid_file.read_text().strip())
os.kill(pid, signal.SIGUSR1)
any_running = True
except Exception:
continue
any_running = True
if not any_running:
print("No dnsmasq instances are running.")