post backup script issues...


Active Member
May 6, 2009
I'm trying to send backup files to a remote Restic server but there seems to be an issue with the shell that proxmox runs backups in.
I had to add a lot of things to try and get bash commands to work, bash -lic has helped in a few places but I'm sure there's something neater which could make things work better.

Any advice would be greatly appreciated as I'm over 2 days into this now...

The idea is Restic will handle which backups to keep and when while further backups will be made with an old tape autoloader.


# This script should be run after Proxmox backup completes to ensure that big files drive backups, not log files...
# /etc/vzdump.conf - backup default settings location

export RESTIC_PASSWORD=password #environmental variable password, needed to access repo.
backupdir=/tmp/backup/proxmox #all symlinks and files are transferred to here.


bash -lic "if [[ ${COMMAND} == 'job-end' ]]; then"
#if [ "$1" == "job-end" ]; then
mkdir $backupdir
bash -lic "mkdir -p $backupdir/{vz/dump/configs,config/etc/network/interfaces,logs}" #Move vz backups to backup directory:
ln -s /etc/pve/qemu-server/ $backupdir/vz/dump/configs #Symlink vm config files to sub-directory
ln -s /etc/network/interfaces $backupdir/config/etc/network/interfaces #Symlink Proxmox host network config file
ln -s /var/log/ $backupdir/logs #Symlink system logs
mv /var/lib/vz/dump/* $backupdir/vz/dump/

#restic -r /srv/restic-repo --verbose backup /tmp/backup/ #if installed normally. Currently running from binary which I can't be bothere$
#/usr/local/restic -r /usr/bin/sftp:root@ --verbose backup /tmp/backup/
bash -lic "/usr/local/restic -r sftp:root@ --verbose backup /tmp/backup/"
bash -lic "fi"
exit 0;


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!