Results 1 to 7 of 7

Thread: Minecraft server auto run

  1. #1
    Join Date
    Jan 2008
    Beans
    50

    Minecraft server auto run

    So I have recently been playing the called Minecraft. I run my own server and recently I have been SSH into my server and running the java command to run it. When when im done I stop the server and terminate my SSH connection. I want to get around this. I want to have the server run from start and I'm a bit confused. Ive read that I could make a bash to do this and something about running it as deamon. Could anyone help me out or possible sort out which way to does this?

  2. #2
    Join Date
    May 2010
    Beans
    73

    Re: Minecraft server auto run

    sure. first, open a terminal and type:

    Code:
    sudo cp /etc/init.d/rc.local minecraft
    gksu gedit minecraft &
    now change the script to refer to your specific application.. in the do_start change the log message to say it is starting minecraft, change the outer if statement and the line after the log line to the name of your application... something like this:

    Code:
    do_start() {
        if [ -x /path/to/minecraft ]; then
                [ "$VERBOSE" != no ] && log_begin_msg "Running local minecraft script (/path/to/minecraft)"
            /path/to/minecraft
            ES=$?
            [ "$VERBOSE" != no ] && log_end_msg $ES
            return $ES
        fi
    }
    save the file as /etc/init.d/minecraft, and return to the terminal. finally prepare the script and add it to the system runlevel so it will call it on startup:

    Code:
    sudo chmod u+x  /etc/init.d/minecraft
    sudo ln -s /etc/init.d/minecraft /etc/rc2.d/S99minecraft
    «If I've seen very far, it's only because I was that desperate to leave.»
    robisinho : mi colección de música : favoritas recientes

  3. #3
    Join Date
    Jan 2008
    Beans
    50

    Re: Minecraft server auto run

    Ok i see. The only problem is that minecraft is a jar file so I have to start up a java virtual for it using this command.

    Code:
     sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
    unless could I just use the minecraft_server.jar alone?

  4. #4
    Join Date
    Jan 2008
    Beans
    50

    Re: Minecraft server auto run

    Bump

  5. #5
    Join Date
    May 2010
    Beans
    73

    Re: Minecraft server auto run

    Quote Originally Posted by Whiteice View Post
    Ok i see. The only problem is that minecraft is a jar file so I have to start up a java virtual for it using this command.

    Code:
     sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
    unless could I just use the minecraft_server.jar alone?
    that should work just fine .. without the sudo because it will already run as root:
    Code:
    java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
    «If I've seen very far, it's only because I was that desperate to leave.»
    robisinho : mi colección de música : favoritas recientes

  6. #6
    Join Date
    Jan 2011
    Beans
    1

    Re: Minecraft server auto run

    Here is an init script that uses GNU screen:

    http://www.minecraftwiki.net/wiki/Server_startup_script

    EDIT: It is an HUGE security to risk to run the Minecraft server as root. It is good practice to create a user just for Minecraft (like 'minecraft'). Apache does this (www-data or www-user), MySQL (mysql), and many others!

  7. #7
    Join Date
    Sep 2011
    Beans
    6

    Re: Minecraft server auto run

    Edit: wrong thread.
    Last edited by 0PS; September 26th, 2011 at 03:59 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •