diff --git a/src/bin/proxmox-restore-daemon.rs b/src/bin/proxmox-restore-daemon.rs index ebe8cef5..5456bd23 100644 --- a/src/bin/proxmox-restore-daemon.rs +++ b/src/bin/proxmox-restore-daemon.rs @@ -50,9 +50,7 @@ fn main() -> Result<(), Error> { .format_timestamp_millis() .init(); - // the API may save some stuff there, e.g., the memcon tracking file - // we do not care much, but it's way less headache to just create it - std::fs::create_dir_all("/run/proxmox-backup")?; + setup_system_env()?; // scan all attached disks now, before starting the API // this will panic and stop the VM if anything goes wrong @@ -66,6 +64,15 @@ fn main() -> Result<(), Error> { pbs_runtime::main(run()) } +/// ensure we have our /run dirs, system users and stuff like that setup +fn setup_system_env() -> Result<(), Error> { + // the API may save some stuff there, e.g., the memcon tracking file + // we do not care much, but it's way less headache to just create it + std::fs::create_dir_all("/run/proxmox-backup")?; + + Ok(()) +} + async fn run() -> Result<(), Error> { watchdog_init();