add server restart support w/ admin command

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-16 19:46:32 +00:00
parent 2cb31275f0
commit c6f4b20e17
5 changed files with 54 additions and 2 deletions

17
src/main/restart.rs Normal file
View file

@ -0,0 +1,17 @@
#![cfg(unix)]
use std::{env, os::unix::process::CommandExt, process::Command};
use conduit::{debug, info};
pub(super) fn restart() -> ! {
let exe = env::current_exe().expect("program path must be identified and available");
let envs = env::vars();
let args = env::args().skip(1);
debug!(?exe, ?args, ?envs, "Restart");
info!("Restart");
let error = Command::new(exe).args(args).envs(envs).exec();
panic!("{error:?}");
}