[Solved] restart function doesn't work
#1
Hey everyone!

I'm using Cuberite on a Banana pro with Bananian.

When I change settings I have to close and restart Cuberite.
But when I use the "Restart Server" button in webinterface or the "restart" command the server only stops and sont starts after that.

Whats my failure?

EDIT:
Second and third post solved my Problem.
Reply
Thanks given by:
#2
I can confirm this happens to me as well. Apparently, restart is not properly supported. It is not your fault.

In the meantime, I suggest you put Cuberite inside some wrapper script which restarts it whenever it exits:

Save this as wrapper.sh:
#!/bin/sh
while [ 1 -eq 1 ]; do
    ./cuberite
    echo "Restarting Cuberite in 10 seconds..."
    sleep 10
done

To start cuberite:
chmod +x wrapper.sh
./wrapper.sh
Reply
Thanks given by:
#3
The problem with the above script is that you cannot easily stop Cuberite when you really want to. Here's a slightly more sophisticated version:

#!/bin/sh
if [ -f stop.txt ]; then rm stop.txt; fi  # Remove stop.txt if it exists for some reason
while [ ! -f stop.txt  ]; do # Keep restarting cuberite until user creates stop.txt
    ./cuberite
    echo "Restarting Cuberite in 10 seconds..."
    sleep 10
done
rm stop.txt  # Clean up by removing stop.txt

If you stop Cuberite normally, it will restart.
If you create a file called stop.txt, and then stop Cuberite, it will actually stop.
Reply
Thanks given by:
#4
@LogicParrot just as I am reviewing my mind, you should be able to use exit codes. Like restart if exit code is non-zero (eg at interruptions through sigkill or sigsegv) but that wouldn't include a standard stop and therefore the restart. But has this anything to do with the line "couldn't notify input thread, hanging up or killing?" (not exactly sure about the second part part)

Anyway, in bash scripting the exit code of the last command is $? So you can check with test -n (AFAIK, not tested). See man test
Reply
Thanks given by:
#5
Big Grin 
(05-03-2016, 04:35 AM)LogicParrot Wrote: The problem with the above script is that you cannot easily stop Cuberite when you really want to. Here's a slightly more sophisticated version:

#!/bin/sh
if [ -f stop.txt ]; then rm stop.txt; fi  # Remove stop.txt if it exists for some reason
while [ ! -f stop.txt  ]; do # Keep restarting cuberite until user creates stop.txt
    ./cuberite
    echo "Restarting Cuberite in 10 seconds..."
    sleep 10
done
rm stop.txt  # Clean up by removing stop.txt

If you stop Cuberite normally, it will restart.
If you create a file called stop.txt, and then stop Cuberite, it will actually stop.

Thanks LogicParrot, this solved my problem!!
I had only to change "./cuberite" to "./Cuberite".
So now the restart of server works!!!Big Grin
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)