mirror of
https://github.com/auricom/home-cluster.git
synced 2025-09-17 18:24:14 +02:00
feat: reworked truenas backup script
This commit is contained in:
@@ -6,15 +6,12 @@
|
|||||||
# Configuration backup Cloud Sync pre-script
|
# Configuration backup Cloud Sync pre-script
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
SOURCE_FOLDER="/var/db/system/configs"
|
DATE=$(date +%Y%m%d)
|
||||||
BACKUP_FOLDER="{{ backups_dir }}servers/{{ ansible_facts['nodename'] }}"
|
BACKUP_FOLDER="{{ backups_dir }}servers/{{ ansible_facts['nodename'] }}"
|
||||||
|
|
||||||
cd ${SOURCE_FOLDER}*
|
cp -p /data/freenas-v1.db ${BACKUP_FOLDER}/${DATE}.db
|
||||||
rsync --archive --delete --human-readable --delete ./ ${BACKUP_FOLDER}
|
chmod -R 775 ${BACKUP_FOLDER}/${DATE}.db
|
||||||
test $? -ne 0 && FLAG_NOTIF=true
|
chown -R homelab:homelab ${BACKUP_FOLDER}/${DATE}.db
|
||||||
|
|
||||||
chmod -R 775 ${BACKUP_FOLDER}/*
|
|
||||||
chown -R homelab:homelab ${BACKUP_FOLDER}/*
|
|
||||||
|
|
||||||
# Keep the last 90 backups on disk
|
# Keep the last 90 backups on disk
|
||||||
# find ${BACKUP_FOLDER}/* -mtime +90 -type f -delete
|
find ${BACKUP_FOLDER}/*.db -mtime +90 -type f -delete
|
||||||
|
Reference in New Issue
Block a user