Simple start script for Minecraft servers
wget https://raw.githubusercontent.com/Minecon724/PixelStart.sh/master/start.sh
chmod +x start.sh
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
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
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.)
- curl
- lsof
- screen
- restart.sh file (created by the script if missing)