vzdump wait between VM

ddarko

Member
Jul 4, 2009
30
0
6
Poland
Hi,
My command to perform backups as follows:
vzdump --quiet 1 --bwlimit 20480 --mode snapshot --all 1 --ionice 7 --compress lzo --storage local

Despite ionice and bwlimit during backup server for a few minutes is not responsive.
I thought it would be good to wait a while between each VM.
How to do it?
Naturally, to keep the "--all" option.

eg.
vzdump --quiet 1 --bwlimit 20480 --mode snapshot --all 1 --ionice 7 --compress lzo --storage local --waitbetween 60

Which causes a break of 60 seconds between the backup each VM.
 
VZDump has a hook up script option. You can pass it a script and VZDump runs that on event like backup start, stop, abort and so on.
I made a sample script which should fit your need:
Code:
#!/bin/bash
if [ "$1" == "backup-end" ]; then
    sleep 60;  # here goes your time in seconds
fi
save that in a file, for example vzdump_wait_hook.sh then a vzdump command like this would run it:
Code:
vzdump --all --compress lzo --storage my_nfs --mode snapshot --remove 0 --node pvenode1 --script ./hook-test.sh

If you have basic knowledge of scripting your possibility are almost infinity... Note, the script hasn't to be bash, everything your server can run is allowed, also compiled c program or whatever.

------
EDIT: if you want to control the sleep time in your vzdump command, use this:
Code:
#!/bin/bash
if [ "$2" == "backup-end" ]; then
    sleep $1; # seconds defined by parameter
fi
Now you can give the hook script your desired waiting time as a parameter:
Code:
vzdump --all --compress lzo --storage nfs_wl --mode snapshot --remove 0 --node devpve --script "./hook-test.sh 20"
here it would sleep 20 seconds between backups...
 
Last edited by a moderator:

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!