add numa service restart command

Kills the running process and lets launchd/systemd respawn it
with the updated binary. DNS stays configured throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Razvan Dimescu
2026-03-20 14:26:56 +02:00
parent 48657aec6c
commit 14a9e9e7e3
2 changed files with 36 additions and 3 deletions

View File

@@ -14,8 +14,8 @@ use numa::override_store::OverrideStore;
use numa::query_log::QueryLog;
use numa::stats::ServerStats;
use numa::system_dns::{
discover_system_dns, install_service, install_system_dns, service_status, uninstall_service,
uninstall_system_dns,
discover_system_dns, install_service, install_system_dns, restart_service, service_status,
uninstall_service, uninstall_system_dns,
};
#[tokio::main]
@@ -41,9 +41,10 @@ async fn main() -> numa::Result<()> {
return match sub.as_str() {
"start" => install_service().map_err(|e| e.into()),
"stop" => uninstall_service().map_err(|e| e.into()),
"restart" => restart_service().map_err(|e| e.into()),
"status" => service_status().map_err(|e| e.into()),
_ => {
eprintln!("Usage: numa service <start|stop|status>");
eprintln!("Usage: numa service <start|stop|restart|status>");
Ok(())
}
};
@@ -57,6 +58,7 @@ async fn main() -> numa::Result<()> {
eprintln!(" uninstall Restore original system DNS settings");
eprintln!(" service start Install as system service (auto-start on boot)");
eprintln!(" service stop Uninstall the system service");
eprintln!(" service restart Restart the service with updated binary");
eprintln!(" service status Check if the service is running");
eprintln!(" help Show this help");
eprintln!();