upgrade brain_backup script to handle include & exclude

This commit is contained in:
Ludovic Cartier 2024-12-16 16:37:20 +01:00
parent 888b155015
commit a0fb7ff4bb
2 changed files with 18 additions and 8 deletions

View File

@ -84,14 +84,17 @@ sudo su - postgres -c "/usr/bin/pg_dumpall --roles-only > $backup_dir/$today/pos
find $backup_dir -type d -ctime +$backup_retention -exec rm -rf {} \; find $backup_dir -type d -ctime +$backup_retention -exec rm -rf {} \;
## send to PBS ## ## send to PBS ##
# TODO : this need to be templified ! /usr/bin/proxmox-backup-client backup slash.pxar:/ \
/usr/bin/proxmox-backup-client backup system.pxar:$backup_dir/$today/system --rate ${PBS_RATE} {% for item in backup_path %}
/usr/bin/proxmox-backup-client backup etc.pxar:/etc/ --rate ${PBS_RATE} {% if item.fs_mount }}--include-dev {{ item.path }} \{% endif %}
/usr/bin/proxmox-backup-client backup var_www.pxar:/var/www/ --rate ${PBS_RATE} --exclude 'html' --exclude 'lost+found' --exclude='*.sock' --exclude='*.log' --exclude='.cache/' {% endfor %}
/usr/bin/proxmox-backup-client backup opt.pxar:/opt/ --rate ${PBS_RATE} {% if backup_pgsql_enabled %}
/usr/bin/proxmox-backup-client backup mysql.pxar:$backup_dir/$today/mysql --rate ${PBS_RATE} postgresql.pxar:$backup_dir/$today/postgresql \
/usr/bin/proxmox-backup-client backup postgresql.pxar:$backup_dir/$today/postgresql --rate ${PBS_RATE} {% endif %}
/usr/bin/proxmox-backup-client backup slash.pxar:/ --rate ${PBS_RATE} --include-dev /opt/docker-compose --include-dev /home {% if backup_mysql_enabled %}
mysql.pxar:$backup_dir/$today/mysql \
{% endif %}
--rate ${PBS_RATE}
## end of send to PBS ## ## end of send to PBS ##
## PBS logout ## ## PBS logout ##

7
templates/pxarexclude.j2 Normal file
View File

@ -0,0 +1,7 @@
/*
{% for item in backup_path %}
{% if item.exclude }}{{ item.exclude }}{% endif %}
{% endfor %}
{% for item in backup_path %}
!{{ item.value }}
{% endfor %}