Minecraft server geht nach einiger zeit aus wenn niemand spielt?

1 Antwort

Eventuell hilft das, ansonstenstarte ich meinen minecraft server automatisch so:
1. tmux installieren
2. nano ServerStart.sh im Serververzeichnis:
#!/bin/sh
# Start the server.
start_server() {
   java -server -XmsMIN_RAM -XmxMAX_RAM JAVA_PARAMETERS -jar $SERVER.JAR nogui
}
echo "Starting Minecraft Server..."
start_server

3. nano start_tmux.sh
#!/bin/bash

# Check if tmux is installed
if ! command -v tmux &> /dev/null; then
   echo "Error: tmux is not installed. Please install tmux first."
   exit 1
fi

# Name of the tmux session
SESSION_NAME="mc"

# Path to the shell file you want to run
SHELL_FILE="ServerStart.sh"

# Directory in which to run the shell script
WORKING_DIRECTORY="/pfad/zum/serververzeichnis/" # Update this with the correct path

# Create a new tmux session or attach to an existing one

tmux new-session -d -s "$SESSION_NAME" -c "$WORKING_DIRECTORY" || tmux attach-session -t "$SESSION_NAME"

# Send the command to run the shell file in the new pane
tmux send-keys -t "$SESSION_NAME:0" "bash $SHELL_FILE" Enter

# Split the window horizontally
tmux split-window -h

# Attach to the newly created session
tmux attach-session -t "$SESSION_NAME"

4. sudo crontab -e -u DeinLinuxMCNutzer
5. paste "@reboot /pfad/zur/start_tmux.sh
Hoffe das klappt so alles.


ImmoFocken 
Fragesteller
 25.07.2023, 18:26

danke das teste ich mal

0