Minecraft Bedrock Server on Seedbox

Help with operating systems, apps, and software-related issues.
User avatar
ccb056
Site Administrator
Posts: 1003
Joined: January 14th, 2004, 11:36 pm
Location: Texas

Minecraft Bedrock Server on Seedbox

Post by ccb056 »

https://www.minecraft.net/en-us/download/server/bedrock

Download binary to /bin/minecraft

Code: Select all

unzip bedrock-server-1.21.131.1.zip

Code: Select all

LD_LIBRARY_PATH=../bedrock_server

Code: Select all

./bedrock_server
if you see
NO LOG FILE! - Failed to up file descriptor limit Operation not permitted
check:

Code: Select all

ulimit -a
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 2062520
max locked memory (kbytes, -l) 8192
max memory size (kbytes, -m) unlimited
open files (-n) 4096
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 2000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
fix (temporary):

Code: Select all

ulimit -n 4096
Run on boot:

Code: Select all

mkdir -p ~/.config/minecraft

Code: Select all

touch ~/.config/minecraft/start

Code: Select all

chmod +x ~/.config/minecraft/start

Code: Select all

vi ~/.config/minecraft/start

Code: Select all

#!/bin/bash
# start
ulimit -n 4096
cd ~/bin/minecraft
tmux new -d -s minecraft './bedrock_server'
to start:

Code: Select all

~/.config/minecraft/start
to run on boot:

Code: Select all

crontab -e

Code: Select all

@reboot ~/.config/minecraft/start
to list:

Code: Select all

tmux ls
to attach:

Code: Select all

tmux attach -t minecraft
to detach:

Code: Select all

Ctrl + B, then D

to stop:

Code: Select all

pkill -f bedrock_server
User avatar
ccb056
Site Administrator
Posts: 1003
Joined: January 14th, 2004, 11:36 pm
Location: Texas

Re: Minecraft Bedrock Server on Seedbox - Update

Post by ccb056 »

Code: Select all

vi ~/.config/minecraft/update-bedrock.sh

Code: Select all

#!/usr/bin/env bash
set -euo pipefail

HOME_DIR="$HOME"
INSTALL_DIR="$HOME_DIR/bin/minecraft"
TMP_DIR="$HOME_DIR/bedrock-tmp"
API_URL="https://net-secondary.web.minecraft-services.net/api/v1.0/download/links"
ZIP_NAME="bedrock.zip"

command -v jq >/dev/null || { echo "jq is required"; exit 1; }

echo "Fetching version info..."
DATA=$(curl -fsSL "$API_URL")
DOWNLOAD_URL=$(echo "$DATA" | jq -r '.result.links[] | select(.downloadType == "serverBedrockLinux") | .downloadUrl')
VERSION=$(basename "$DOWNLOAD_URL" | grep -o '[0-9.]\+')

[[ -z "$DOWNLOAD_URL" || -z "$VERSION" ]] && { echo "Failed to extract URL/version"; exit 1; }

[[ -f "$INSTALL_DIR/bedrock-server.version" && "$(cat "$INSTALL_DIR/bedrock-server.version")" == "$VERSION" ]] && {
  echo "Already up to date"
  exit 0
}

mkdir -p "$TMP_DIR"
wget -q -O "$TMP_DIR/$ZIP_NAME" "$DOWNLOAD_URL"
unzip -t "$TMP_DIR/$ZIP_NAME" >/dev/null || { echo "ZIP test failed"; exit 1; }
unzip -oq "$TMP_DIR/$ZIP_NAME" -d "$TMP_DIR/unpacked"

[[ -x "$TMP_DIR/unpacked/bedrock_server" ]] || { echo "Missing server binary"; exit 1; }

rsync -a \
  --exclude='autoupdate.sh' \
  --exclude='server.properties' \
  --exclude='permissions.json' \
  --exclude='whitelist.json' \
  --exclude='ops.json' \
  --exclude='allowlist.json' \
  --exclude='valid_known_packs.json' \
  --exclude='worlds/' \
  "$TMP_DIR/unpacked/" "$INSTALL_DIR/"

echo "$VERSION" > "$INSTALL_DIR/bedrock-server.version"
rm -rf "$TMP_DIR"
echo "Updated to version $VERSION"

Code: Select all

chmod +x ~/.config/minecraft/update-bedrock.sh