Giter VIP home page Giter VIP logo

mcscripts's Introduction

Description

Minecraft Java Edition and Bedrock Dedicated Server (BDS for short) systemd units, bash scripts, and IRC bot for backups, automatic updates, installation, and shutdown warnings

@@@ Compatible with Ubuntu @@@

Ubuntu on Windows 10 does not support systemd (Try my Ubuntu Server 18.04 Setup). You can run the scripts without enabling the systemd units, except for MCBEautoUpdate.sh. No automatic update scripts or IRC bot for Java Edition.

Notes

How to attach to the systemd service's tmux session (server console):

sudo su mc -s /bin/bash
# Example: systemctl status mc@$instance
tmux -S "/tmp/tmux-mc/$instance" a

Press Ctrl-B then D to detach from a tmux session. exit to switch back to previous user.

How to control systemd services:

# Backup Minecraft Java Edition server
sudo systemctl start mc-backup@MC
# Stop Minecraft Java Edition server
sudo systemctl stop mc@MC

Backups are in ~mc by default. systemctl status mc-backup@MC mcbe-backup@MCBE says the last backup's location. Outdated bedrock-server ZIPs in ~mc will be removed by MCBEgetZIP.sh. MCBEupdate.sh only keeps packs, worlds, JSON files, and PROPERTIES files. Other files will be removed. You cannot enable instances of Java Edition and Bedrock Edition with the same name (mc@example and mcbe@example).

PS4 and Xbox One can only connect on LAN, Nintendo Switch cannot connect at all. Try jhead/phantom to work around this on PS4 and Xbox One. Try ProfessorValko's Bedrock Dedicated Server Tutorial.

Setup

Open Terminal:

sudo apt install git tmux wget zip
git clone https://github.com/TapeWerm/MCscripts.git
cd MCscripts
sudo adduser --home /opt/MC --system mc
# I recommend replacing the 1st argument to ln with an external drive to dump backups on
# Example: sudo ln -s $ext_drive ~mc/backup_dir
sudo ln -s ~mc ~mc/backup_dir

Copy and paste this block:

echo set -g default-shell /bin/bash | sudo tee ~mc/.tmux.conf
for file in $(ls *.sh); do sudo cp "$file" ~mc/; done
sudo chown -h mc:nogroup ~mc/*
for file in $(ls systemd); do sudo cp "systemd/$file" /etc/systemd/system/; done

Java Edition setup

Stop the Minecraft server.

# Move server directory
sudo mv "$server_dir" ~mc/MC
# Open server.jar with no GUI and 1024-2048 MB of RAM
echo java -Xms1024M -Xmx2048M -jar server.jar nogui | sudo tee ~mc/MC/start.bat

Copy and paste this block:

sudo chmod 700 ~mc/MC/start.bat
sudo chown -R mc:nogroup ~mc/MC
sudo systemctl enable [email protected] [email protected] --now

If you want to automatically remove backups more than 2-weeks-old to save storage:

sudo systemctl enable [email protected] --now

Bedrock Edition setup

Stop the Minecraft server.

# Move server directory or
sudo mv "$server_dir" ~mc/MCBE
# Make new server directory
sudo su mc -s /bin/bash
~/MCBEgetZIP.sh
exit
sudo ~mc/MCBEautoUpdate.sh ~mc/MCBE

Copy and paste this block:

sudo chown -R mc:nogroup ~mc/MCBE
sudo systemctl enable [email protected] [email protected] mcbe-getzip.timer [email protected] --now

If you want to automatically remove backups more than 2-weeks-old to save storage:

sudo systemctl enable [email protected] --now

Bedrock Edition IRC bot setup

If you want to post connect/disconnect messages to IRC:

sudo su mc -s /bin/bash
mkdir ~/.MCBE_Bot

Enter nano ~/.MCBE_Bot/MCBE_BotJoin.txt, fill this in, and write out (^G = Ctrl-G):

JOIN #chan $key
irc.domain.tld:$port

Copy and paste this block:

exit
sudo systemctl enable [email protected] [email protected] --now

mcscripts's People

Contributors

tapewerm avatar mrrogers75 avatar pfeiferj avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.