use service Type=notify
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
9c351a36c4
commit
d98c9a7a38
|
@ -5,6 +5,7 @@ Maintainer: Proxmox Support Team <support@proxmox.com>
|
|||
Build-Depends: bash-completion,
|
||||
debhelper (>= 10),
|
||||
libpam0g-dev,
|
||||
libsystemd-dev,
|
||||
libzstd-dev (>= 1.3.8),
|
||||
pkg-config,
|
||||
python3-docutils,
|
||||
|
|
|
@ -5,8 +5,9 @@ After=network.target
|
|||
Requires=proxmox-backup.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=notify
|
||||
ExecStart=%LIBEXECDIR%/proxmox-backup/proxmox-backup-proxy
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
User=%PROXY_USER%
|
||||
Group=%PROXY_USER%
|
||||
|
|
|
@ -4,8 +4,9 @@ Wants=network-online.target
|
|||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Type=notify
|
||||
ExecStart=%LIBEXECDIR%/proxmox-backup/proxmox-backup-api
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
|
|
@ -67,6 +67,8 @@ fn run() -> Result<(), Error> {
|
|||
},
|
||||
)?;
|
||||
|
||||
daemon::systemd_notify(daemon::SystemdNotify::Ready)?;
|
||||
|
||||
tokio::run(lazy(|| {
|
||||
|
||||
let init_result: Result<(), Error> = try_block!({
|
||||
|
|
|
@ -100,6 +100,8 @@ fn run() -> Result<(), Error> {
|
|||
},
|
||||
)?;
|
||||
|
||||
daemon::systemd_notify(daemon::SystemdNotify::Ready)?;
|
||||
|
||||
tokio::run(lazy(|| {
|
||||
|
||||
let init_result: Result<(), Error> = try_block!({
|
||||
|
|
|
@ -103,6 +103,9 @@ impl Reloader {
|
|||
}
|
||||
Ok(ForkResult::Parent { child }) => {
|
||||
eprintln!("forked off a new server (pid: {})", child);
|
||||
if let Err(e) = systemd_notify(SystemdNotify::MainPid(child)) {
|
||||
log::error!("failed to notify systemd about the new main pid: {}", e);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => {
|
||||
|
@ -178,8 +181,12 @@ where
|
|||
crate::tools::request_shutdown(); // make sure we are in shutdown mode
|
||||
if server::is_reload_request() {
|
||||
log::info!("daemon reload...");
|
||||
if let Err(e) = systemd_notify(SystemdNotify::Reloading) {
|
||||
log::error!("failed to notify systemd about the state change: {}", e);
|
||||
}
|
||||
if let Err(e) = reloader.take().unwrap().fork_restart() {
|
||||
log::error!("error during reload: {}", e);
|
||||
let _ = systemd_notify(SystemdNotify::Status(format!("error during reload")));
|
||||
}
|
||||
} else {
|
||||
log::info!("daemon shutting down...");
|
||||
|
|
Loading…
Reference in New Issue