Excludes by variables

ojaksch

Renowned Member
Oct 11, 2015
200
46
93
Germany/Earth
I'm playing around with proxmox-backup-client and (bash) scripts. Everything works great so far, including "fixed" --excludes parameters.
Working example:
Code:
BACKUPNAME="AllWithoutHome"
mount /dev/sda1 /mnt -o ro,noatime
proxmox-backup-client backup ${BACKUPNAME}.pxar:/mnt --backup-id ${BACKUPNAME} --all-file-systems --skip-lost-and-found --verbose true --exclude '/home/user/*'
umount /mnt

Non-working example:
Code:
BACKUPNAME="AllWithoutHome"
EXCL="--exclude '/home/user/*'"
mount /dev/sda1 /mnt -o ro,noatime
proxmox-backup-client backup ${BACKUPNAME}.pxar:/mnt --backup-id ${BACKUPNAME} --all-file-systems --skip-lost-and-found --verbose true ${EXCL}
umount /mnt

Even non-working example:
Code:
BACKUPNAME="AllWithoutHome"
EXCL="'/home/user/*'"
mount /dev/sda1 /mnt -o ro,noatime
proxmox-backup-client backup ${BACKUPNAME}.pxar:/mnt --backup-id ${BACKUPNAME} --all-file-systems --skip-lost-and-found --verbose true --exclude ${EXCL}
umount /mnt

So what's the point I'm missing here by using variables for excludes?
 
Last edited:
Oooh, I love that to help myself while complaing :) The secret is to omit the single quotes in variables.

Now working example:
Code:
BACKUPNAME="AllWithoutHome"
EXCL="--exclude /home/user/*"
mount /dev/sda1 /mnt -o ro,noatime
proxmox-backup-client backup ${BACKUPNAME}.pxar:/mnt --backup-id ${BACKUPNAME} --all-file-systems --skip-lost-and-found --verbose true ${EXCL}
umount /mnt

But the next thing I'm trying and failing is the exclude vice versa, to exclude everything but a subfolder. I'm using --exclude '/*' --exclude '!/home/user/*' as stated in the documentation (page 55) but that doesn't work.
 

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!