Restart your minecraft server on VPS ?

Discussion in 'Systems Administration' started by sub911, Jun 18, 2019.

  1. When I do /restart it just stops the server & every time I do it, I have to run the command that starts the there a way to make that automated or make the /restart cmd work?
  2. Answered here:
    Restart script

    If you have any further problems, just write them here.
  3. It will just execute the in your server directory. In the spigot.yml you can change the shell file name of it
  4. chcp 936
    @Echo off&setlocal enabledelayedexpansion
    回声************************************************* ****
    回声************************************************* ****
    设置a = -1
    设置/ a + = 1
    回声************************************************* ****
    回声************************************************* ****
    title战墙#3 [重启次数:%a%]
    rd / s / q日志
    rd / s / q世界
    xcopy。\ worldsave / c / q / s
    set / as = 1 + 1
    for / l %% i in(1,1,!s!)do(
    设置/ a s- = 1
    ping -n%s%127.1> nul
    Java -Dfile.encoding = UTF-8 -XX:+ AlwaysPreTouch -XX:+ DisableExplicitGC -XX:+ UseG1GC -XX:+ UnlockExperimentalVMOptions -XX:MaxGCPauseMillis = 45 -XX:TargetSurvivorRatio = 90 -XX:G1NewSizePercent = 50 -XX: G1MaxNewSizePercent = 80 -XX:InitiatingHeapOccupancyPercent = 10 -XX:G1MixedGCLiveThresholdPercent = 50 -XX:+ AggressiveOpts -Xmx3G -Xms1G -jar PaperSpigot-1.8.8.jar
  5. You need to have a startup file named
    place this in your server and edit with notepad++ to change to your ram and a custom name.
    Afterwards type cd <yourdirectory>
    And then type bash
    If that doesnt work type: sudo yum install bash
    Then try again.
    Anyways. heres the file code.
    Code (Text):
    for session in $(screen -ls | grep -o '[0-9]\{3,\}\.\S*')
            screen -r CUSTOMNAME -p0 -X stuff "&9Server is restarting.\015"
            screen -r CUSTOMNAME -p0 -X stuff "stop\015" # Send "stop\r" to the CUSTOMNAME server.
    echo 'Starting server...'

        screen -dmS "CUSTOMNAME" java -Xmx3G -jar -Xincgc server.jar nogui
        sleep 1
        while [ $(screen -ls | grep -c 'No Sockets found in') -ge 1 ]; do
            echo 'Waiting for 5 seconds to start server...'
            sleep 5
            screen -dmS "CUSTOMNAME" java -Xmx3G -jar -Xincgc server.jar nogui

    echo 'Server started.'