[SOLVED] scheduled automatic restore via qmrestore?

fips

Renowned Member
May 5, 2014
178
10
83
Hey Guys,

I am thinking about a scheduled (via Cron?) automatic restore of VMs which have been backed up via PBS.
My first attempt was via CLI but I can set the date via variable but not the timestamp as wildcard.

Bash:
qmrestore my.pbs:backup/vm/710/2025-04-18* 810 -storage HDD_36T
unable to parse PBS volume name 'backup/vm/710/2025-04-18*'

Any idea how I can specify the restore file?

Happy easter to everyone
 
Not sure with a wildcard what you expect ..... (which one to restore etc.)

But according to the manpage it reads standard input:
<archive>: <string>
The backup file. You can pass - to read from standard input.

So you probably need to script it something like this:

Code:
#!/bin/bash
bkuparchive=$(ls path/to/pbs/2025-04-18*)
qmrestore my.pbs:backup$bkuparchive 810 -storage HDD_36T
I've used the ls command (as for a mounted storage) but you could probably equally use pvesm list <pbs-storage> --vmid <vmid> or proxmox-backup-client snapshot list [group] with parsing.

Disclaimer: Never done anything like this (nor needed to!) & haven't tested this either.

Good luck.
 
  • Like
Reactions: leesteken and UdoB
hmm well this would work somehow if the pbs are mounted, but out of the box the pbs storage isn't.
Well I don't want to harm the backup infrastructure doing some hacky stuff..
 
Thanks to your support I could get it done:
if once someone need a hint

Bash:
DATE=$(date '+%Y-%m-%d' -d "1 day ago")
FILEall=$(pvesm list my.pbs --vmid 810 | grep ${DATE})
FILE=$(echo ${FILEall} | awk '{print $1}')
qmrestore ${FILE}  810 -storage HDD_36T
 
  • Like
Reactions: leesteken
Code:
FILEall=$(pvesm list my.pbs --vmid 810 | grep ${DATE})
FILE=$(echo ${FILEall} | awk '{print $1}')
One line:
Code:
FILE=$(pvesm list my.pbs --vmid 810 | grep ${DATE} | awk '{print $1}')

Anyway, happy you got it working.

Maybe mark this thread as Solved. At the top of the thread, choose the Edit thread button, then from the (no prefix) dropdown choose Solved.
 
  • Like
Reactions: leesteken