Minecon724 / PixelStart.sh

Just a start (and stop, restart, status check, autorestart, etc) script for Minecraft servers...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PixelStart.sh

Simple start script for Minecraft servers

Installation

wget https://raw.githubusercontent.com/Minecon724/PixelStart.sh/master/start.sh
chmod +x start.sh

Usage

Basic commands:

Start the server.

./start.sh start

Stop the server.

./start.sh stop

Restart the server.

./start.sh restart

Allows you to execute console commands.

./start.sh input

Returns the server status.

./start.sh status

Get the status code.

./start.sh check

Disable server auto-save.

./start.sh saveoff

Enable server auto-save.

./start.sh saveon

When you use crontab to send regularly a save-all command, using saveoff deny sending "save-all" command, usefull when running backups.

If you want to hook this script to the in-game /restart command, replace this in spigot.yml:

  restart-script: ./start.sh

with:

  restart-script: ./restart.sh

Watchdog commands:

When used with crontab, this script can automatically restart your server when it crashed.

Displays watchdog status.

./start.sh watchdog

Activate monitoring

./start.sh wdon

Deactivate monitoring

./start.sh wdoff

Watchdog rescan command

./start.sh wdcheck

Append this to your cronjob file (access it via crontab -e):

* * * * * bash /path/to/server/start.sh wdcheck

Check function return code:

Using ./start.sh check will return a status code, here is some explanation about it.

From 0 to 7 : The server file is missing. When 2, 4 or 6 is returned, it the server is online.

From 8 to 9 : The server is offline.

  • (8 = no server running at specified port)
  • (9 = but there is a pid file)

From 10 to 11 : Server is running BUT the screen session is not found. (Server out of screen, maybe false positive)

  • (10 = port specified was listening)
  • (11 = and there is a PID file)

From 12 to 13 : Server is offline, but there is a screen session. (Can be a false positive, when server is too slow or freezing a lot)

  • (12 = Screen session found, but no server was listen at specified port)
  • (13 = and there is a PID file)

From 14 to 15 : Server is running.

  • (14 = PID file was missing.)
  • (15 = PID file was found.)

Dependencies:

  • curl
  • lsof
  • screen
  • restart.sh file (created by the script if missing)

About

Just a start (and stop, restart, status check, autorestart, etc) script for Minecraft servers...

License:The Unlicense


Languages

Language:Shell 100.0%