CentOS server/bukkit problems

Discussion in 'Bukkit Help' started by CAPTAIN205s, May 19, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    CAPTAIN205s

    This is my server configuration CentOS 5 - 64 bit ; Java SE Runtime Enviroment build 1.7.0_04 ;

    I start the server with this command : java -Xms1024M -Xmx2600M -jar craftbukkit.jar nogui

    i use bukkit version 1.2.5-R2.o

    But everytime I Ctrl+C out of the console the Minecraft Server goes offline . This also happens when i just close my command console .
    The server is a quadcore Xenon with 8GB of DDR2 RAM .
    My question is how can i keep the Bukkit server running after I close the command console ?
    Also the vanilla version didn't had this problem .
    Thanks in advance .
     
  2. Offline

    Tibs

    I use screen and a couple of scripts to wrap everything up.

    You don't have to rm and link the log file but I do that just to keep things clean. You should create these scripts in the same directory as your craftbukkit.jar. Also create a folder named Backups in that directory if you want to use the log rotate bit.

    The mc-server.sh script actually starts and runs the server, it is a loop so that for whatever reason the server process dies, ie. you run stop from in game, It will automatically restart. It sleeps for 10 seconds so you can exit out after the server stops. From within a screen session and you run the stop command, after it says 'done' you know the server is completely stopped and can safely hit Ctrl-C to exit.

    mc-server.sh
    Code:
    #!/bin/bash
    cd /dir/that/craftbukkit.jar/lives
    while true; do
        rm ./server.log
        ln -s ~/Backups/minecraft-server.log."$(date +%Y-%m-%d-%H.%M.%S)" ./server.log
        java -Xms1024M -Xmx2600M -jar craftbukkit.jar nogui
        echo "done"
        sleep 10
    done
    
    start-mc.sh
    Code:
    #!/bin/bash
    screen -dmS mcserver ./mc-server.sh
    
    The mcserver bit is the screen session name and you can use that to connect to it later.

    make both the scripts executable.

    Code:
    chmod 755 mc-server.sh start-mc.sh
    Then simply run
    Code:
    ./start-mc.sh
    to start up the server.

    start-mc.sh runs mc-server.sh inside a screen session that you can connect or disconnect without causing the server process to terminate. You can of course rename things how ever you like.

    To connect to the screen session named mcserver use the command:

    Code:
    screen -r mcserver
    From here you can use minecraft console commands like normal.

    Then (this is important) use 'Ctrl-a' then hit 'd' to disconnect from the screen session and leave it running.

    Code:
    screen -list
    will show running screens.
     
Thread Status:
Not open for further replies.

Share This Page