Since I could not find a way to backup most important pve config files, I made this little script.
It creates a tar file of most important config files and sends the file to an email address.
May be someone can use.
It creates a tar file of most important config files and sends the file to an email address.
May be someone can use.
Bash:
#!/bin/bash
#
apt install mutt
#
RECIPIENT=user@example.com
THISHOST=$(hostname -f)
TARFILE=${THISHOST}.tar
if [ -f /etc/network/interfaces ]; then
tar -cf ${TARFILE} /etc/network/interfaces
fi
if [ -f /etc/sysctl.conf ]; then
tar -rf ${TARFILE} /etc/sysctl.conf
fi
if [ -f /etc/vzdump.conf ]; then
tar -rf ${TARFILE} /etc/vzdump.conf
fi
if [ -f /etc/fstab ]; then
tar -rf ${TARFILE} /etc/fstab
fi
if [ -f /etc/pve/vzdump.cron ]; then
tar -rf ${TARFILE} /etc/pve/vzdump.cron
fi
if [ -f /etc/pve/user.cfg ]; then
tar -rf ${TARFILE} /etc/pve/user.cfg
fi
if [ -f /etc/pve/storage.cfg ]; then
tar -rf ${TARFILE} /etc/pve/storage.cfg
fi
if [ -f /etc/pve/firewall/cluster.fw ]; then
tar -rf ${TARFILE} /etc/pve/firewall/cluster.fw
fi
echo "tar backup from ${THISHOST}" | mutt -s "${TARFILE}" "${RECIPIENT}" -a ${TARFILE}
rm ${TARFILE}