restore daemon: add setup_system_env helper

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-23 08:10:55 +02:00
parent 02631056b8
commit 73e1ba65ca
1 changed files with 10 additions and 3 deletions

View File

@ -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();