Coder Social home page Coder Social logo

minecraft-server-tools's Introduction

minecraft-server-tools

My minecraft server management script with safe online backup.

Supports backing up using several backends to multiple local and remote directories.

Dependencies

Either of backup backends:

All of them are available on the Debian repository.

Configuration

Config variables are located at serverconf.sh.

Usage

./server.sh start|stop|attach|status|backup|fbackup|restore|ls

start

Creates a tmux session and starts a minecraft server within. Fails, if a session is already running with the same sessionname.

stop

Sends stop command to running server instance to safely shut down.

attach

Attaches to tmux session with a server. Detach with CTRL + A d.

status

Shows if the server is running.

backup

Creates a backup of the current world:

  • If a running server is detected, the world is flushed to disk and autosave is disabled temporarily to prevent chunk corruption.

  • Initializes backup directories if needed.

  • Backs up the world if there are players on the server. The backup has $BACKUP_NAME_<current time> prefix.

  • Performs tests: backup is pulled from each backup directory and is compared to the current world. This behaviour is controlled with $BACKUP_CHECK_MODE.

  • The command specified in $BACKUP_HOOK is executed on every successful backup. $ARCHNAME contains the relative path to the archive. This can be used to further process the created backup.

This is recommended for automated backups.

Warning If all players leave just before a backup, progress is not saved.

fbackup

Does the same as backup, but does not check for presence of players.

This is not recommended for automated use except for deduplicating backup backends (bup and borgbackup).

restore

Restores a backup from selected directory. Old world is preserved with a current timestamp.

ls

Lists backups in all directories.

Start automatically

Create user and group minecraft with home in /var/minecraft. Populate the directory with server.sh, serverconf.sh, backends and a server jar. Place minecraft.service in /etc/systemd/system/ and run systemctl start minecraft to start once or systemctl enable minecraft to enable autostarting.

To backup automatically, place or symlink mc-backup.service and mc-backup.timer in /etc/systemd/system/. Run the following:

sudo systemctl  enable mc-backup.timer
sudo sytemctl start mc-backup.timer

This wil start the enable the timer upon startup and start the timer to run the backup after every interval specified in mc-backup.timer.

Disclaimer

The scripts are provided as-is at no warranty. They are in no way idiot-proof.

Improvements are welcome.

TODO

  • Allow non-forced backup to be run one time with no players on the server.
  • Reach similar automated behaviour without depending on systemd?

minecraft-server-tools's People

Contributors

kamicreed avatar kompetenzbolzen avatar themightyv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.