Vault warden and backup
This commit is contained in:
@@ -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 {} +
|
||||
Reference in New Issue
Block a user