Skip to main content

tuwunel_admin/server/
restart.rs

1use tuwunel_core::{Err, Result, utils::sys::current_exe_deleted};
2
3use crate::admin_command;
4
5#[admin_command]
6pub(super) async fn restart(&self, force: bool) -> Result {
7	if !force && current_exe_deleted() {
8		return Err!(
9			"The server cannot be restarted because the executable changed. If this is expected \
10			 use --force to override."
11		);
12	}
13
14	self.services.server.restart()?;
15
16	self.write_str("Restarting server...").await
17}