Tutorials/Ubuntu startup script

This is a simple startup-script for the upstart mechanism used by ubuntu-servers. It won't give you a console, which I don't consider a problem since there's an ingame console anyway. It also doesn't update Minecraft, I believe there's a built-in updater coming on the way.

Prerequisites
sudo adduser --system --no-create-home --home /srv/minecraft-server minecraft sudo chown -R minecraft /srv/minecraft-server sudo nano /etc/init/minecraft-server.conf and pasting the following into it. Don't forget to change the directory after "chdir" to your installation
 * add a user for minecraft so that it doesn't run as root
 * hand your server-installation over to our new user, I have mine in /srv/minecraft-server
 * install the upstart script by opening /etc/init/minecraft-server.conf (NOT /etc/init.d but /etc/init (without the .d)
 * 1) description "start and stop the minecraft-server"

console log

exec start-stop-daemon --stop "stop" --start --chdir  --chuid minecraft \ --exec /usr/bin/java -- -Xms1536M -Xmx2048M -jar minecraft_server.jar nogui 2>&1

start on runlevel [2345] stop on runlevel [^2345]

respawn respawn limit 20 5

Since Ubuntu 13.10 having both --stop "stop" and --start causes a errors, remove the --stop "stop" and use ps -ef to get PID and use kill PID to close it if you require it shut down to change settings.

Usage
sudo start minecraft-server sudo stop minecraft-server
 * to start the server
 * to stop the server

Troubles?
You can check the server log by using: tail /var/log/upstart/minecraft-server.log

If that doesn't help, just contact me: User:Cel1ne