From 1dcb7ff9e53ac4aedde41b0d3cebe6ec712da06f Mon Sep 17 00:00:00 2001 From: Hutson Date: Tue, 13 Jan 2026 09:35:40 -0500 Subject: [PATCH] Auto-sync: 20260113-093539 --- MINECRAFT.md | 29 +++++++------ scripts/minecraft-backup-all.sh | 77 +++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 scripts/minecraft-backup-all.sh diff --git a/MINECRAFT.md b/MINECRAFT.md index 3465039..681916b 100644 --- a/MINECRAFT.md +++ b/MINECRAFT.md @@ -250,21 +250,23 @@ The editor is hosted by LuckPerms, so no additional port forwarding is needed. ### Automated Backups to TrueNAS -Backups run automatically every 6 hours and are stored on TrueNAS. +Backups run automatically every 2 hours and are stored on TrueNAS for both servers. | Setting | Value | |---------|-------| | **Destination** | TrueNAS (10.10.10.200) | | **Path** | `/mnt/vault/users/backups/minecraft/` | -| **Frequency** | Every 6 hours (12am, 6am, 12pm, 6pm) | -| **Retention** | 14 backups (~3.5 days of history) | -| **Size** | ~2.3 GB per backup | -| **Script** | `/home/hutson/minecraft-backup.sh` on docker-host2 | +| **Frequency** | Every 2 hours (12 backups per day) | +| **Retention** | 30 backups per server (~2.5 days of history) | +| **Hutworld Size** | ~2-7 GB per backup | +| **Backrooms Size** | ~100-150 MB per backup | +| **Script** | `/home/hutson/minecraft-backup-all.sh` on docker-host2 | | **Log** | `/home/hutson/minecraft-backup.log` on docker-host2 | -### Backup Script +### Backup Scripts -**Location:** `~/minecraft-backup.sh` on docker-host2 +**Main Script:** `~/minecraft-backup-all.sh` on docker-host2 (backs up both servers) +**Legacy Script:** `~/minecraft-backup.sh` on docker-host2 (Hutworld only) ```bash #!/bin/bash @@ -292,10 +294,10 @@ sshpass -p 'GrilledCh33s3#' scp -o StrictHostKeyChecking=no "$LOCAL_BACKUP" "$BA # Clean up local temp file rm -f "$LOCAL_BACKUP" -# Keep only last 14 backups on TrueNAS +# Keep only last 30 backups on TrueNAS sshpass -p 'GrilledCh33s3#' ssh -o StrictHostKeyChecking=no hutson@10.10.10.200 ' cd /mnt/vault/users/backups/minecraft - ls -t hutworld-*.tar.gz 2>/dev/null | tail -n +15 | xargs -r rm -f + ls -t hutworld-*.tar.gz 2>/dev/null | tail -n +31 | xargs -r rm -f ' ``` @@ -305,7 +307,7 @@ sshpass -p 'GrilledCh33s3#' ssh -o StrictHostKeyChecking=no hutson@10.10.10.200 # View current schedule ssh docker-host2 'crontab -l | grep minecraft' -# Output: 0 */6 * * * /home/hutson/minecraft-backup.sh >> /home/hutson/minecraft-backup.log 2>&1 +# Output: 0 */2 * * * /home/hutson/minecraft-backup-all.sh >> /home/hutson/minecraft-backup.log 2>&1 ``` ### Manual Backup Commands @@ -609,10 +611,11 @@ tar -xzf /tmp/hutworld-*.tar.gz -C /tmp --strip-components=2 \ ## Migration History -### 2026-01-04: Backup System +### 2026-01-04: Backup System (Updated 2026-01-13) -- Configured automated backups to TrueNAS every 6 hours -- Set 14-backup retention (~3.5 days of recovery points) +- Configured automated backups to TrueNAS +- **Updated frequency:** Every 2 hours (was 6 hours) +- **Updated retention:** 30 backups (~2.5 days) (was 14 backups) - Created backup script with compression and cleanup - Storage: `/mnt/vault/users/backups/minecraft/` diff --git a/scripts/minecraft-backup-all.sh b/scripts/minecraft-backup-all.sh new file mode 100644 index 0000000..3dd2900 --- /dev/null +++ b/scripts/minecraft-backup-all.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# Minecraft Servers Backup Script (All Servers) +# Backs up both Hutworld and Backrooms servers to TrueNAS + +BACKUP_DEST="hutson@10.10.10.200:/mnt/vault/users/backups/minecraft" +DATE=$(date +%Y-%m-%d_%H%M) + +echo "[$(date)] Starting Minecraft servers backup..." + +# Backup Hutworld server +HUTWORLD_SRC="$HOME/crafty/data/servers/19f604a9-f037-442d-9283-0761c73cfd60" +HUTWORLD_BACKUP="/tmp/hutworld-$DATE.tar.gz" + +echo "[$(date)] Backing up Hutworld server..." +tar -czf "$HUTWORLD_BACKUP" \ + --exclude="*.jar" \ + --exclude="cache" \ + --exclude="libraries" \ + --exclude=".paper-remapped" \ + -C "$HOME/crafty/data/servers" \ + 19f604a9-f037-442d-9283-0761c73cfd60 + +echo "[$(date)] Hutworld backup created: $(ls -lh $HUTWORLD_BACKUP | awk '{print $5}')" + +# Transfer Hutworld backup to TrueNAS +sshpass -p 'GrilledCh33s3#' scp -o StrictHostKeyChecking=no "$HUTWORLD_BACKUP" "$BACKUP_DEST/" + +if [ $? -eq 0 ]; then + echo "[$(date)] Hutworld backup transferred successfully" + rm "$HUTWORLD_BACKUP" +else + echo "[$(date)] ERROR: Failed to transfer Hutworld backup" +fi + +# Backup Backrooms server +BACKROOMS_SRC="$HOME/crafty/data/servers/64079d6c-acb0-48c4-9b21-23e0fa354522" +BACKROOMS_BACKUP="/tmp/backrooms-$DATE.tar.gz" + +echo "[$(date)] Backing up Backrooms server..." +tar -czf "$BACKROOMS_BACKUP" \ + --exclude="*.jar" \ + --exclude="cache" \ + --exclude="libraries" \ + --exclude=".paper-remapped" \ + -C "$HOME/crafty/data/servers" \ + 64079d6c-acb0-48c4-9b21-23e0fa354522 + +echo "[$(date)] Backrooms backup created: $(ls -lh $BACKROOMS_BACKUP | awk '{print $5}')" + +# Transfer Backrooms backup to TrueNAS +sshpass -p 'GrilledCh33s3#' scp -o StrictHostKeyChecking=no "$BACKROOMS_BACKUP" "$BACKUP_DEST/" + +if [ $? -eq 0 ]; then + echo "[$(date)] Backrooms backup transferred successfully" + rm "$BACKROOMS_BACKUP" +else + echo "[$(date)] ERROR: Failed to transfer Backrooms backup" +fi + +# Clean up old backups (keep last 30 of each server) +echo "[$(date)] Cleaning up old backups..." +sshpass -p 'GrilledCh33s3#' ssh -o StrictHostKeyChecking=no hutson@10.10.10.200 ' + cd /mnt/vault/users/backups/minecraft + + # Keep only last 30 Hutworld backups + ls -t hutworld-*.tar.gz 2>/dev/null | tail -n +31 | xargs -r rm -f + + # Keep only last 30 Backrooms backups + ls -t backrooms-*.tar.gz 2>/dev/null | tail -n +31 | xargs -r rm -f + + echo "Current backups:" + echo "Hutworld: $(ls -1 hutworld-*.tar.gz 2>/dev/null | wc -l) backups" + echo "Backrooms: $(ls -1 backrooms-*.tar.gz 2>/dev/null | wc -l) backups" + echo "Total size: $(du -sh . | cut -f1)" +' + +echo "[$(date)] All backups complete!" \ No newline at end of file