#!/bin/bash #List of files to in/exclude form the backup located /.pxarexclude #Scipt config PBS_Host= PBS_Datastore= PBS_User=root@pam! export PBS_PASSWORD="" export PBS_FINGERPRINT="" PBS_NameSpace=PVE-Hosts Run_Purge=false Purge_DryRun=true Run_GarbageColletion=false ##end of config export PBS_LOG=info #Possible values are off, error, warn, info, debug and trace export PBS_REPOSITORY="$PBS_User@$PBS_Host:$PBS_Datastore" PVE_Hostname=$(hostname) PBS_NameSpace=$PBS_NameSpace/"$PVE_Hostname" echo "Generating package(APT) report" apt-mark showmanual > /SystemRepport-APT echo "Generating PVE report" pvereport 2> /dev/null > /SystemRepport-PVE echo "Running backup" proxmox-backup-client backup root.pxar:/ --include-dev /etc/pve --ns $PBS_NameSpace ##Prunne while runing instead of using jobs in PBS # Docs: https://pbs.proxmox.com/docs/backup-client.html#pruning-and-removing-backups # # Prune options --keep-last --keep-hourly --keep-daily --keep-weekly --keep-monthly --keep-yearly # # To test and generate a repport set Run_Purge and Purge_DryRun to true # To use Run_Purge to true Purge_DryRun to false if $Run_Purge; then if ! $Purge_DryRun; then echo purge proxmox-backup-client prune host/"$PVE_Hostname" --keep-daily 1 --keep-weekly 3 --ns $PBS_NameSpace else echo dry proxmox-backup-client prune host/"$PVE_Hostname" --dry-run --keep-daily 1 --keep-weekly 3 --ns $PBS_NameSpace | tee Pruge-DryRun fi fi if $Run_GarbageColletion; then proxmox-backup-client garbage-collect fi rm /SystemRepport-PVE /SystemRepport-APT