wotking
This commit is contained in:
18
app/sbin/backup/N8N
Executable file
18
app/sbin/backup/N8N
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail # Fail on error, undefined variables, and pipe errors
|
||||
|
||||
# Create backup filename
|
||||
FILENAME="$(date +"%Y%m%d_%H%M").zip"
|
||||
BACKUP_DIR="/BACKUP/$UUID"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
tar -czvf "$BACKUP_DIR/$FILENAME" -C "/4server/data" "$UUID"
|
||||
|
||||
# Remove old backups beyond the configured slots
|
||||
ls -t "$BACKUP_DIR"/[0-9]*.zip 2>/dev/null | tail -n +$((BACKUP_SLOTS + 1)) | while read -r file; do
|
||||
echo "Deleting old backup: $file"
|
||||
doas rm -f "$file"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user