Vault warden and backup

This commit is contained in:
2026-09-02 19:59:46 +01:00
parent cb4c51b3b2
commit 9f3ebe71e8
6 changed files with 280 additions and 129 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Format the current date
NOW=$(date +"%Y-%m-%d")
# Create the archive directory if it does not exist
mkdir -p /backup/archive
# Run rsync with an exclude file and a backup directory for changed/deleted files
rsync -av --delete \
--exclude-from=/config/exclude.txt \
--backup --backup-dir=/backup/archive/$NOW \
/data/ /backup/latest/
# Find and delete archive directories older than 7 days
find /backup/archive/ -mindepth 1 -maxdepth 1 -type d -mtime +7 -exec rm -rf {} +