How to automate proxmox-backup-client for PVE host?

krby

New Member
Dec 9, 2024
21
4
3
I guess this is yet another post about backing up files on the PVE host. I've done some searching and reading of the docs, so `proxmox-backup-client` feels like the right way to get the actual backup. What isn't clear to me is how to create a backup job that uses this, or if it can't be done from a backup job, what the right proxmox-y way is to run a regular task like this. I know I can use cron, but I'm hoping for better integration of the job, status, scheduling, etc in the GUI.


Concretely I think I will end up with a shell script like this:
Bash:
#!/bin/bash
export PBS_PASSWORD="mypassword"
export PBS_LOG=INFO
proxmox-backup-client backup pve-etc.pxar:/etc --include-dev /etc/pve pve-root.pxar:/root --repository admin@pbs@backups.example.com:pbs --keyfile /path/to/my-backup.key

I've seen the script hook feature of backup jobs, but from what I can tell, that's intended to do something at various stages of a CT or VM backup. It didn't look like a way to just run a script on a schedule.

Or, is there a way to create a backup job on the cmdline that does host files only?
 
Last edited:
This has puzzled me since I started working with Proxmox. This backup client ... seems less than optimal. I don't know if I even want to touch it.
I looked at another system called Relax and Recover, but didn't get too far with it.
I still don't have a solution.

I never backup ESXi hosts. IMO you shouldn't have to for PVE either.
But when you rebuild a PVE host, if you want to use the same name, you either need to manually rip it out of the cluster in several places (so you can re-add it), or you need to restore the original thumbprint stuff (so the cluster thinks its the same box).

I'd love a quick, easy answer to that challenge. How can I restore the original identity to a rebuilt machine?
Other than that, I'd rather treat a PVE host like an interchangeable appliance. Maybe backup cron?
 
Last edited:
Concretely I think I will end up with a shell script like this:
Bash:
#!/bin/bash
export PBS_PASSWORD="mypassword"
export PBS_LOG=INFO
proxmox-backup-client backup pve-etc.pxar:/etc --include-dev /etc/pve pve-root.pxar:/root --repository admin@pbs@backups.example.com:pbs --keyfile /path/to/my-backup.key

I've seen the script hook feature of backup jobs, but from what I can tell, that's intended to do something at various stages of a CT or VM backup. It didn't look like a way to just run a script on a schedule.

Or, is there a way to create a backup job on the cmdline that does host files only?
It's even better to export PBS_REPOSITORY and have the password in a secret file with PBS_PASSWORD_FILE.

Your cmd line should work, but I'm afreid you should use namespaces to identify host backups (with --ns <namespace>)

Then, for restoring, the docs say that it's better to use a "manual" method, mounting the file with fuse, or use the command line interactively.
 
Thanks for the replies, but they don't get at the key question(s) in my original post:
How do I schedule a script like this? Can it be a backup job? Or is there some other scheduling mechanism in the PVE GUI that I missed?

I know I can use cron, but I'm hoping for better integration so I get the notification framework, job progress, logs, etc like I get with backup jobs.
 
But when you rebuild a PVE host, if you want to use the same name, you either need to manually rip it out of the cluster in several places (so you can re-add it), or you need to restore the original thumbprint stuff (so the cluster thinks its the same box).

I'd love a quick, easy answer to that challenge. How can I restore the original identity to a rebuilt machine?
Other than that, I'd rather treat a PVE host like an interchangeable appliance. Maybe backup cron?
I'm not actually looking/expecting the restored PVE host to be identical. I'm just trying to cut out my time to restore and part of that is host specific configuration. I've been a naughty boy and installed and configured a few things on the PVE host a NUT client for UPS handling, stats gathering (I can't seem to get all the system stats I want from PVE's built-in "ship metrics to InfluxDB", etc.
 
  • Like
Reactions: tcabernoch
I guess this is yet another post about backing up files on the PVE host. I've done some searching and reading of the docs, so `proxmox-backup-client` feels like the right way to get the actual backup. What isn't clear to me is how to create a backup job that uses this, or if it can't be done from a backup job, what the right proxmox-y way is to run a regular task like this. I know I can use cron, but I'm hoping for better integration of the job, status, scheduling, etc in the GUI.


Concretely I think I will end up with a shell script like this:
Bash:
#!/bin/bash
export PBS_PASSWORD="mypassword"
export PBS_LOG=INFO
proxmox-backup-client backup pve-etc.pxar:/etc --include-dev /etc/pve pve-root.pxar:/root --repository admin@pbs@backups.example.com:pbs --keyfile /path/to/my-backup.key

I've seen the script hook feature of backup jobs, but from what I can tell, that's intended to do something at various stages of a CT or VM backup. It didn't look like a way to just run a script on a schedule.

Or, is there a way to create a backup job on the cmdline that does host files only?
i think i read it was coming , but for now a cron job work fine
 
  • Like
Reactions: krby