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