Tutorials/Ubuntu startup script

From Minecraft Wiki
Jump to: navigation, search
Warning
Since this is a wiki and anyone may modify any page at any time, it is suggested that you do not actually use this script but instead simply use it as a guideline for writing your own.

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.

[edit] Prerequisites

  • add a user for minecraft so that it doesn't run as root
sudo adduser --system --no-create-home --home /srv/minecraft-server minecraft
  • hand your server-installation over to our new user, I have mine in /srv/minecraft-server
sudo chown -R minecraft /srv/minecraft-server
  • install the upstart script by opening /etc/init/minecraft-server.conf (NOT /etc/init.d but /etc/init (without the .d)
sudo vi /etc/init/minecraft-server.conf

and pasting the following into it. Don't forget to change the directory after "chdir" to your installation

# description "start and stop the minecraft-server"

chdir <your installation> # mine is /srv/minecraft-server

exec su -s /bin/sh -c 'exec "$0" "$@"' minecraft -- /usr/bin/java -Xms1536M -Xmx1536M -jar minecraft_server.jar nogui > /dev/null

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

[edit] Usage

  • to start the server
sudo start minecraft-server
  • to stop the server
sudo stop minecraft-server

[edit] Troubles?

Just contact me: User:Cel1ne

Personal tools
Namespaces
Variants
Actions
Minecraft Wiki
Minecraft
Useful pages
Toolbox

Recent Community Articles

Mojang Tweets

    Getting your tweets...
Become a Premium Member!