#!/bin/sh
BACKUP_PATH="/mnt/pve/kut-nas-backup/"
BACKUP_FILE="pve-config-host-$HOSTNAME"
KEEP_DAYS=30
PVE_BACKUP_SET="/etc/pve/ /etc/lvm/ /etc/modprobe.d/ /etc/network/interfaces /etc/vzdump.conf /etc/sysctl.conf /etc/resolv.conf  /etc/hosts /etc/hostname /etc/cron* /etc/aliases /etc/fstab /opt/host_conf/"
PVE_CUSTOM_BACKUP_SET=""

mkdir -p /opt/host_conf
crontab -l > /opt/host_conf/crontab.txt
tar -czf $BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%d-%H_%M_%S).tar.gz --absolute-names $PVE_BACKUP_SET $PVE_CUSTOM_BACKUP_SET 
find $BACKUP_PATH$BACKUP_FILE-* -mindepth 0 -maxdepth 0 -depth -mtime +$KEEP_DAYS -delete
