Tutorials/Server startup script

This is an example of possible Minecraft server startup and maintenance script for Linux distros.

Download
To download the script with wget, run the following: wget -O minecraft "http://www.minecraftwiki.net/Server_startup_script/Script?action=raw"

Requirements

 * screen

Installation
Use your favorite editor to create file called minecraft in /etc/init.d/ and paste the script above in that file.

Edit the USERNAME and MCPATH -variables according to your setup. If you use a wrapper script, change INVOCATION to start it instead of starting the server directly.

Make sure the newly created file has required permissions You can set the permissions by running: chmod 755 /etc/init.d/minecraft

Then run (on debian based distros) update-rc.d minecraft defaults to add required symbolic links. Note: your system will most likely warn you that the script does not meet all requirements. The script will however work.

You can also setup an entry in your crontab to backup the server with: /etc/init.d/minecraft backup

A sample crontab to backup every half hour on the hour, and 30 minutes into the hour:

You have 2 solutions :

0,30 * * * * root /etc/init.d/minecraft backup
 * Edit /etc/crontab and add

crontab -e and add this 0,30 * * * * /etc/init.d/minecraft backup
 * Or type :

Uninstall
(In debian based linux distro) update-rc.d -f minecraft remove

Usage
/etc/init.d/minecraft start stop, restart, backup or update

Alternative Startup Scripts
The following scripts offer the same functions as the above script but contain more useful features:
 * mcwrapper
 * [Multi World] Linux Minecraft server control script
 * MC Sheller