#!/bin/bash
# tar-backup
PATH=/tmp
NOW=$(/bin/date +%Y%m%d-%H%M%S)
FQDN=$(/bin/hostname -f)
/bin/mkdir -p $PATH/$NOW && cd $PATH/$NOW
/bin/tar -cvf $PATH/$NOW/$NOW-$FQDN.tar /root/* /etc/* /var/lib/pve-cluster/* /var/spool/cron/* /usr/share/kvm/*
# pbs-backup
PBS_PASSWORD='my-password'
PBS_FINGERPRINT='my-fingerprint'
PBS_REPOSITORY='backup@pbs@pbs-hostname:pbs-storagename'
export PBS_PASSWORD
export PBS_FINGERPRINT
export PBS_REPOSITORY
/usr/bin/proxmox-backup-client backup root.pxar:$PATH/$NOW/ --keyfile /path/to/my/keyfile.enc
# cleanup
/bin/rm -rf $PATH/$NOW
exit 0