Auto restart server at stop for SurvivalGamesX

Hi,
I would like to know how to stop automatically restart the server.
restart-script line in
spigot.yml:

settings:
save-user-cache-on-stop-only: false
user-cache-size: 1000
late-bind: false
bungeecord: false
netty-threads: 4
sample-count: 12
player-shuffle: 0
filter-creative-items: true
int-cache-limit: 1024
timeout-time: 60
restart-on-crash: true
restart-script: ???

I haven’t used spigot, so this is just speculation, but my best guess is if you want to stop the server from attempting a restart, simply change “restart-on-crash” to false. Thus, the restart-script value will be entirely ignored if and when the jar crashes.

Exactly, I want the server restarts itself after the stop. is reset to the map hunger games.

survival x rebootserver at end of party.
I want automatically start server after stop.
On Linux and Windows, no problem with simple script. it is only on MineOS the server doesn’t restart…

So do you want to stop the automatic restart? Because that seems very different from:

That said, MineOS is Linux. There’s no difference between the two except that the web-ui wants Minecraft jars opened up using a screen instance so that it can send it commands.

You’ll need to provide better detail about what you’re attempting, what you’ve had success with on Linux, and what you have that is failing on MineOS to discern what needs to change. All signs point to you do want restart-on-crash=true followed by a simple modification to the script it runs.

I just want my minecraft server comes back on after a stop.
On windows, script restart minecraft server:

@ECHO OFF
:begin

echo #########################################
echo ## Auto Restart Script ##
echo ## ##
echo ## Press Ctrl + C ONLY when this ##
echo ## message shows to stop the loop. ##
echo #########################################
java -Xmx1024M -jar spigot179.jar
goto begin

But, in Mine OS ?

For a server to be detected in MineOS, it must be started as a screen instance.

cd /usr/games/minecraft && ./mineos_console.py -s servername start

Just as how if you were to type in java -Xmx1024M -jar spigot179.jar in the command line manually, MineOS would have no idea about it because it is not identified by the naming convention: “mc-servername”

I know this.
I start my server with MineOS, so, how to start server auto after stop ?

UP please :frowning:
It’s for my server…

From my experience with Spigot:

  • Server will not attempt to restart if it was stopped properly (e.g. using /stop)

  • If server crashes or restarts with /restart command, it will try to run ./start.sh script, if there is one. If this is your case, read here about working example on MineOS.
    If yours is first case, than the only option is to schedule check whether server is online and run it if not - somehow.
    If you not sure - read or pastebin your server.log (/log/latest.log)
    Default settings in spigot.yml are:

    restart-on-crash: true
    restart-script: ./start.sh
    
1 Like

Scheduled every second to see if the servers are high is too high for the processor.
The aim is that the mini games server reboot after the game. Plugin stop the server. I just want it restarts just after …
I have 40 mini games…

SurvivalGamesX has an option to restart:

# You will need a script that restarts the server once it's shutdown.
restartMinutes = '0'   # Restart the server after this many minutes. 0 to disable.
restartGames = '0'   # Restart the server after this many games. 0 to disable.

I think it uses /restart, not /stop command, cannot test it now, though. You can determine it by reading server.log (or /log/latest.log) look for ‘…Trying to restart with ./start.sh’
If this is the case try set up scripts like here (last post): https://github.com/hexparrot/mineos/issues/85

My logs :

[23:16:53] [Server thread/INFO]: Saving chunks for level ‘LobbyHG12j’/Overworld
[23:16:53] [Server thread/INFO]: Saving chunks for level ‘ArenaHG1’/Overworld
[23:16:53] [Server thread/ERROR]: Exception stopping the server
net.minecraft.server.v1_7_R3.ExceptionWorldConflict: The save for world located at ./ArenaHG1 is being accessed from another location, aborting
at net.minecraft.server.v1_7_R3.WorldNBTStorage.checkSession(WorldNBTStorage.java:72) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.World.G(World.java:2840) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.WorldServer.a(WorldServer.java:825) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.WorldServer.save(WorldServer.java:798) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.MinecraftServer.saveChunks(MinecraftServer.java:377) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.MinecraftServer.stop(MinecraftServer.java:409) ~[spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot179.jar:git-Spigot-1543]
at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [spigot179.jar:git-Spigot-1543]
[23:16:53] [Thread-4/INFO]: Stopping server
[23:16:53] [Thread-4/INFO]: Saving players
[23:16:53] [Thread-4/INFO]: Saving worlds
[23:16:53] [Thread-4/INFO]: Saving chunks for level ‘LobbyHG12j’/Overworld

Is that’s it? I thought, phrase ‘Stopping server’ must be there at least twice if it stops, like here http://pastebin.com/jCQvrXaL or like here http://pastebin.com/f0GcfJ1w if it restarts (./start.sh exists in server folder)
And that error… Is it always like that?

1 Like

Yes, I always have this error … I left that one to test the plugin, it’s the same … I’ll test with another version of spigot, I see her as a solution to the time.

With spigot 1.7.2 it’s not ok… Log is copy past…

Can you, please, provide some more of log output? The whole latest.log would be ideal, if it does not contain any confidential data like passwords, of course. The easiest way to do it is to install pastebinit:

# apt-get install pastebinit  

(as root)
and then just

# pastebinit latest.log  
http://paste.debian.net/131461/

My logs :

http://188.165.230.25/hglatest.log

Time start to stop

Bad luck. A /restart command exists only in Spigot, not Bukkit, for which plugins are written.

As a workaround you can do the following:

  1. Disable onreboot/crontabs start, archive, backup in server.config in MineOS WebUI

  2. Copy SurvivalGames.sh file from /var/games/minecraft/servers/YOUR_SERVER_NAME/plugins/SurvivalGames/Examples/
    to /var/games/minecraft/servers/YOUR_SERVER_NAME/

  3. Rename it to start.sh mv SurvivalGames.sh start.sh (optional)

  4. Make it executable chmod 777 start.sh
    5a. Edit start.sh - change jar file, memory setting, etc. If in doubt, run ps ax | grep YOUR_SERVER_NAME, you will get output like this:

    root@core /home/mc# ps ax | grep AngelSpigot
    1219 ? Ss 0:00 /usr/bin/SCREEN -dmS mc-AngelSpigot /usr/bin/java -server -Xmx3700M -Xms2048M -server -Dfile.encoding=UTF-8 -jar /var/games/minecraft/servers/AngelSpigot/spigot.jar
    1220 pts/0 Ssl+ 115:42 /usr/bin/java -server -Xmx2048M -Xms2048M -server -Dfile.encoding=UTF-8 -jar /var/games/minecraft/servers/AngelSpigot/spigot.jar
    13216 pts/6 S+ 0:00 grep --color=auto AngelSpigot
    Copy line starting with /usr/bin/java… (till the end of line) to start.sh instead of java -Xms…
    5b. (Optional, but strongly recommended) Add line cd /var/games/minecraft/servers/YOUR_SERVER_NAME before line from step 5a

  5. Make sure MC server is not running

  6. Start start.sh - better run it as ‘mc’ user. If you are logged in as root, do /bin/su - mc start.sh

  7. If you want to auto start server on host boot - you must run this command on startup somehow (for example add it to /etc/init.d/mineos after 'start') line, just be sure to use full path to script)

This can work, but you will loose all of MineOS features, except console log (read only, no commands)

Another possibilities:

  1. (Ask someone to) Write a plugin that will execute /restart command on server shutdown or add restart functionality to shutdown process - must be easy for those who can

  2. Ask SurvivalGamesX developer to add Spigot /restart support (best option, if possible)

  3. Ask hexparrot (or anyone else) to add feature to wrap server start command with editable script file and add looping to it - I have little to no time for it now.
    Also in this case scheduled archiving/restarting will cause problems and stopping server will be a challenge )))

  4. Use this script as start.sh:

    #!/bin/bash
    while true ; do
    sleep 60
    cd /usr/games/minecraft
    ./mineos_console.py -s YOUR_SERVER_NAME start
    done
    It will check if server is running every 60 seconds (changeable) and run it if not. You can also make it run at host startup. All MineOS features will work. Don’t forget to make start.sh and /usr/games/minecraft/mineos_console.py executable.

I use spigot 1.7.9, not craftbukkit…
This server is running CraftBukkit version git-Spigot-1543 (MC: 1.7.9)