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
+7
View File
@@ -0,0 +1,7 @@
FROM alpine:latest
RUN apk add --no-cache rsync tzdata
COPY backup.sh /usr/local/bin/backup.sh
RUN chmod +x /usr/local/bin/backup.sh
CMD ["crond", "-f", "-l", "2"]
+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 {} +
+2
View File
@@ -0,0 +1,2 @@
# Run the backup every day at 2:00 AM
0 2 * * * /usr/local/bin/backup.sh
+4
View File
@@ -0,0 +1,4 @@
*.log
.backups
.DS_Store
._*