Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ctempleton3

Members
  • Joined

  • Last visited

  1. I wanted to share a backup script I wrote for running a Minecraft Bedrock server in Docker on Unraid. This script safely backs up the world by coordinating with the server before copying files. FeaturesUses save hold and save query to ensure a consistent backup Waits for Bedrock confirmation: “Data saved. Files are now ready to be copied.” Automatically resumes saves after completion (or on failure) Creates: A timestamped .tar.gz archive A latest uncompressed backup for quick access Rotates backups (keeps newest N copies) Designed for use with User Scripts plugin ⚠️ Configuration RequiredBefore using, update these variables: CONTAINER → your Minecraft container name SOURCE → path to your world folder DEST → where backups should be stored LOGFILE → path to the Bedrock log inside the container Script[code] #!/bin/bash set -euo pipefail DATE=$(date +"%Y-%m-%d_%H-%M-%S") ===== CONFIGURE THESE =====CONTAINER="your-minecraft-container-name" SOURCE="/path/to/minecraft/worlds" DEST="/path/to/backup/location" LOGFILE="/path/to/bedrock/logfile.log" ===========================ARCHIVE="$DEST/minecraft_backup_$DATE.tar.gz" LATEST="$DEST/latest" MAX_WAIT=120 POLL_INTERVAL=2 KEEP_BACKUPS=10 get_screen_session() { docker exec -u nobody "$CONTAINER" screen -wipe >/dev/null 2>&1 || true docker exec -u nobody "$CONTAINER" screen -ls | awk '/.minecraft[[:space:]]+DetachedDetachedDetached/ {print $1; exit}' } send_cmd() { local session="$1" local cmd="$2" docker exec -u nobody "$CONTAINER" screen -S "$session" -p 0 -X stuff $"$cmd\r" } wait_for_ready() { local start_ts now elapsed log_start start_ts=$(date +%s) log_start=$(docker exec "$CONTAINER" sh -c "wc -l < '$LOGFILE'") while true; do send_cmd "$SCREEN_SESSION" "save query" sleep "$POLL_INTERVAL" if docker exec "$CONTAINER" sh -c \ "tail -n +$((log_start + 1)) '$LOGFILE' | grep -q 'Data saved. Files are now ready to be copied.'" ; then return 0 fi now=$(date +%s) elapsed=$((now - start_ts)) if (( elapsed >= MAX_WAIT )); then return 1 fi done } prune_old_backups() { mapfile -t backups < <(find "$DEST" -maxdepth 1 -type f -name 'minecraft_backup_*.tar.gz' | sort -r) if (( ${#backups[@]} > KEEP_BACKUPS )); then echo "Pruning old backups..." for old_backup in "${backups[@]:$KEEP_BACKUPS}"; do echo "Removing $old_backup" rm -f "$old_backup" done fi } cleanup() { if [[ -n "${SCREEN_SESSION:-}" ]]; then echo "Cleanup: resuming world saves..." send_cmd "$SCREEN_SESSION" "save resume" || true fi } trap cleanup EXIT mkdir -p "$DEST" echo "Looking up active Minecraft screen session..." SCREEN_SESSION="$(get_screen_session)" if [[ -z "$SCREEN_SESSION" ]]; then echo "ERROR: Could not find a live detached Minecraft screen session." docker exec -u nobody "$CONTAINER" screen -ls || true exit 1 fi echo "Using screen session: $SCREEN_SESSION" echo "Holding world saves..." send_cmd "$SCREEN_SESSION" "save hold" sleep 2 echo "Waiting for Bedrock to report files are ready..." if ! wait_for_ready; then echo "ERROR: Timed out waiting for Bedrock to report backup readiness." exit 1 fi echo "Refreshing latest uncompressed backup..." rm -rf "$LATEST" mkdir -p "$LATEST" cp -a "$SOURCE"/. "$LATEST"/ echo "Creating archive..." tar -czf "$ARCHIVE" -C "$SOURCE" . echo "Pruning backups to keep only the newest $KEEP_BACKUPS..." prune_old_backups echo "Resuming world saves..." send_cmd "$SCREEN_SESSION" "save resume" trap - EXIT echo "Backup complete: $ARCHIVE" echo "Latest uncompressed copy: $LATEST" [/code] How I Use ItInstalled via User Scripts plugin Scheduled (e.g., hourly or daily) Runs on the Unraid host (not inside the container) NotesAssumes your container uses screen (common for many Minecraft Docker images) The latest folder is useful for quick restores without extracting archives The cleanup trap ensures saves resume even if something fails If anyone has improvements or edge cases I didn’t think about, I’d love feedback 👍

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.