Get pvesr schedule-now to wait until everything is replicated

redmop

Well-Known Member
Feb 24, 2015
121
2
58
Is this possible? If not, can we add a --wait paramater to do this? Perhaps a --retry x to try x number of times?
 
Last edited:
Hi,
does using pvesr run --id <JOB-ID> instead work for you? Otherwise, please explain the use case for this in more detail.
 
I want to run a script to backup to an external drive. Nodes 1 and 2 hose running vms. They both replicate to node 3. Node 3 does zfs send to the external. In the script, I want to force replicate now, then wait until the replication is done before doing my zfs send to the external.
 
Is there a problem with using pvesr run --id <JOB-ID> then? AFAICS that command only returns after finishing the replication.
 
pvesr run --id 117-0
trying to acquire lock...
can't lock file '/var/lock/pvesr.lck' - got timeout

It works as long as no other replication is currently running.
 
You're right. What you could try is using
Code:
pvesh get nodes/<NODE>/replication/<JOB-ID>/status
to get the current last_sync timestamp. Then run schedule-now and in a loop with a bit of pause do
Code:
pvesh get nodes/<NODE>/replication/<JOB-ID>/status
again to monitor the last_sync value. When it changes, you know the job has completed.

Of course you can also check the fail_count and conditionally abort the loop.
 
I did it kinda like that, though a wait and retry would be much much cleaner.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!