diff --git a/internal/dnsmasq/config.go b/internal/dnsmasq/config.go index 1add4c1..5c89b3a 100644 --- a/internal/dnsmasq/config.go +++ b/internal/dnsmasq/config.go @@ -104,14 +104,15 @@ func (g *ConfigGenerator) WriteConfig(cfg *config.GlobalConfig, clouds []config. return nil } -// RestartService restarts the dnsmasq service +// RestartService reloads the dnsmasq service (SIGHUP — no downtime). +// Falls back to restart if reload fails. func (g *ConfigGenerator) RestartService() error { - cmd := exec.Command("systemctl", "restart", "dnsmasq.service") + cmd := exec.Command("systemctl", "reload-or-restart", "dnsmasq.service") output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("failed to restart dnsmasq: %w (output: %s)", err, string(output)) + return fmt.Errorf("failed to reload dnsmasq: %w (output: %s)", err, string(output)) } - slog.Info("dnsmasq service restarted", "component", "dnsmasq") + slog.Info("dnsmasq service reloaded", "component", "dnsmasq") return nil }