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 (WATCH OUT SCRIPT NEEDS WORK): 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 a+x /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:

crontab -e and add this 0,30 * * * * /etc/init.d/minecraft backup
 * Using the user account you want the work done under, run:

If the above attempt went poorly because you do not know how to use vi, try: VISUAL=/usr/bin/nano crontab -e

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

Usage
The script may be invoked via the following command on most systems, where "(command)" will be "stop", "start", "restart", or any of the other options it supports. /etc/init.d/minecraft (command) On most RedHat- or Debian-based distribution where the `service` command is available, it should be invoked as: service minecraft (command) To view the screen, use: screen -R

To exit the screen, use: CTRL+a+d

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
 * minecraft init (modification of this script with a lot more features like multiworld)
 * Dagmar d'Surreal's Sysv init script
 * Setsuna-Xero's OpenRC(Gentoo) compatible init script, with conf.d defaults
 * Mineserv Perl Init Script
 * A very simple automatic start/stop script with backup and cleanup functions and the ability to pass commands to the server console.