Skip to main content

MonkeyCraft Server Administration Guide

Overview

The MonkeyCraft Minecraft server runs inside a persistent screen session that is managed by systemd.
This setup automatically starts the server on reboot and restarts it if it crashes or exits unexpectedly.
Admins can easily attach to the running console, issue commands, or restart the service without interrupting gameplay.


⚙️ Service Summary

Item Details
Service name monkeycraft
Working directory /monkeycraft
Launch method screen session (screen -S monkeycraft)
Startup script /monkeycraft/run.sh
Auto restart Enabled via Restart=always
Auto start on boot Yes
Managed by systemd

🧩 Basic Commands

Action Command Description
Start server sudo systemctl start monkeycraft Manually start the server
Stop server sudo systemctl stop monkeycraft Sends /stop command for a clean shutdown
Restart server sudo systemctl restart monkeycraft Cleanly restarts the entire service
Check status systemctl status monkeycraft Shows uptime, PID, and current status
View logs journalctl -u monkeycraft -f Follows live logs
Enable on boot sudo systemctl enable monkeycraft Ensures auto-start after reboot

🧱 Working Inside the Screen Session

The server runs in a screen session named monkeycraft.
Admins can attach to it safely to view or interact with the console.

🔍 Attach to the Console

screen -r monkeycraft

If it reports "attached elsewhere", use:

screen -D -RR monkeycraft

⌨️ Detach Without Stopping the Server

Press:

Ctrl + A, then D

This detaches you from the session while keeping the server running.

🚪 Exit the Screen Session Completely

Inside the screen, type:

stop

This tells Minecraft to save and shut down cleanly.


🔁 Auto-Restart Behavior

  • If the Minecraft process crashes or exits, systemd automatically restarts it after 10 seconds.
  • On reboot, the service starts automatically once the network is online.
  • During a controlled stop, ExecStop sends a friendly warning and issues the /stop command before exiting.

🧰 Troubleshooting

Problem Solution
Server didn’t start at boot sudo systemctl enable --now monkeycraft
“No screen session found” error Fixed in latest unit file — restart service
Java or JAR path issues Check /monkeycraft/run.sh paths and permissions
View detailed logs journalctl -u monkeycraft -n 100 --no-pager
Can’t attach to console screen -D -RR monkeycraft to force attach

🧹 Maintenance Tasks

Log Rotation

To prevent large logs:

sudo logrotate -f /etc/logrotate.d/monkeycraft

Clean Up Old Screen Sessions

Rarely needed, but:

screen -ls
screen -S monkeycraft -X quit

Reload Systemd After Editing Service File

sudo systemctl daemon-reload

🛡️ Best Practices

  • Always stop the server gracefully with /stop or systemctl stop monkeycraft.
  • Avoid killing the process directly — it can corrupt worlds.
  • Before updating mods or configs, stop the server first.
  • After changes, restart using:
    sudo systemctl restart monkeycraft
    
  • Only one screen session should exist for the server — don’t start extra screens manually.

🧾 Notes for Developers

  • JVM arguments and memory limits are stored in:
    /monkeycraft/user_jvm_args.txt
    
  • Minecraft’s own arguments come from:
    /monkeycraft/libraries/net/neoforged/neoforge/21.1.209/unix_args.txt
    
  • To adjust performance, edit user_jvm_args.txt, not the service file.
  • The systemd service simply calls:
    /usr/bin/screen -DmS monkeycraft /bin/bash -lc './run.sh nogui'
    

✅ Quick Reference Cheat Sheet

# Start / stop / restart
sudo systemctl start monkeycraft
sudo systemctl stop monkeycraft
sudo systemctl restart monkeycraft

# View status
systemctl status monkeycraft

# Attach to console
screen -r monkeycraft
# or if attached elsewhere
screen -D -RR monkeycraft

# Follow logs
journalctl -u monkeycraft -f

Last updated: Oct 2025
Maintainer: MonkeyCraft Server Administration Team