/restart don't work


#1

Hi i don’t know where to put this topic on its my first time here :confused:

But i searched almost an entire day and nothing work, i can’t use /restart on my spigot server it just don’t work, everytime i get this :

Error executing “start” because server condition not met: !up

I already checked a lot of topic and nothing helped me, so i’m here to ask if someone know how to make a working one (not something that keep my server up even with /stop, and sorry i’m french)
Oh and i don’t want to use crontab schedul if i can :confused:


#2

/restart is a spigot script, and thus outside MineOS’s control. A quick google search reveals that several others also have problems with spigots restart script.

https://www.google.com/search?client=firefox-b&q=spigot+restart+command+not+working

I cant, however, find someone with that exact description (or error message) that you describe.

The error message “sever condition not met !up” tells me that spigots restart script consists of two commands stop and start your server. Since /stop stops a minecraft server (and kills its java istnance) most of the script is handled in a spigot shells cript (I guess). This leads me to think that /restart fires of a shell command that first tries to stop your server, then to start it again. For some reason the stop command is not sending errors when it is ran, or it is possible not ran at all, so that when the script jumps to the start portion of the script it fails, since your server is all ready running. It is in a state the considers “up”, but it expects a state that equals “!up”, or “Not Up”.

I would take a look in your spigot directory to see if there is a script there called restart.sh or something like that, and to take a look at it’s script. Try to see what the script tries to do, and maybe try out the commands it tries to fire off to see where the script fails.


#3

I created the restart.sh, i had this :

in start.sh.

#!/bin/bash
date >> /var/games/minecraft/servers/evo/starts.log
setsid ./restart.sh & >> /var/games/minecraft/servers/evo/starts.log

and in restart.sh

#!/bin/bash
sleep 300
cd /usr/games/minecraft
./mineos_console.js -s evo start >> /var/games/minecraft/servers/evo/starts.log

edit: I think MineOS don’t update the server state when it execute the commands via /restart so the server close but for MineOS the server is still UP at this moment ?


#4

If that is the entire restart.sh, i can’t see anywhere it tries to stop the server first.

first line tells the script to not show anything onscreen (#!/bin/bash)
the second line tells your script to wait for 300 timeunits (usually milliseconds)
the third line tells your script to enter the minecraft directory
the fourth line sends a start command to your minecraft server, and to log into the file starts.log.

I think you need to modify your script like this:

#!/bin/bash
cd /usr/games/minecraft
./mineos_console.js -s evo stop >> /var/games/minecraft/servers/evo/starts.log
sleep 300
./mineos_console.js -s evo start >> /var/games/minecraft/servers/evo/starts.log

You would the get the chain of commands:

  1. no output
  2. go to minecraft directory
  3. stop server
  4. wait until server is stopped
  5. start server again

#5

i already tried that, when it try to execute the stop command it say:

Error executing “stop” because server condition not met: true


#6

You could conside doing it not scripted, but using cron instead. like in this post [SOLVED] [Bypassed] Restart not working


#7

Yeah i know… :confused: i think MineOS consider the server UP until the script is finish…


#8

MineOS won’t start the server because it believes the server is already up.

The server is considered to be “up” if the process ID of Java is still alive; this PID is captured when MineOS starts the server (through any of MineOS’ methods, console or webui).

This restart script looks to me simply like a start script.

MineOS doesn’t maintain state like that; strictly whether the PID is alive is the test and it’ll be tested on each command (won’t get cached between calls in the same script, etc.)


I recommend you kill all Minecraft processes and try this from the start, tracing to see if you can create a simple ‘stop’ and ‘start’ script (not yet a restart).

When you know each component works, blend them together.