Python wrapper around a Minecraft server that performs periodic rolling backups, automatic restarts on crash, and contains some Easter eggs.
- Clone this repository to the machine or VM with your server
- Run
python3 src/server_config.py
to create the default config file - Edit
config/config.json
for your server. Notable fields to update:server_path
: This is the path where your server jar isstart_command
: Command to run inside of your server path to start the serverbackup_path
: Directory create backups in
- Configure your system to run the server. See below.
systemd
is the recommended approach
- Start the server with:
python3 src/main.py
- The server may also be conditionally started with
python3 src/check_alive.py
which will only run the server if it is not already running. Acrontab
entry could be used to ensure the server is running, althoughsystemd
is a better approach
- The server may also be conditionally started with
- Stop the server with
Ctrl+C
orpython3 src/stop.py
if started in the background
- Update
config/galacticraft.service
:ExecStart
:python3 {path-to-main.py}
User
: User to run the server asGroup
: The group to run the server in
- Install
config/galacticraft.service
toetc/systemd/system
- Reload the systemd daemon:
sudo systemctl daemon-reload
systemctl
can now be used to manage the server:- Set to start on system start:
sudo systemctl enable galacticraft
- Start the server:
sudo systemctl start galacticraft
- Stop the server:
sudo systemctl stop galacticraft
- Restart the server:
sudo systemctl restart galacticraft
- Query server status:
sudo systemctl status galacticraft
- Set to start on system start: