PaperSpigot Restart problem

Okay, so I wanted my server to auto-restart every 24 hours, and I found out a plugin stopped the server instead of restarting it. Thought it was the plugins fault and I deleted it. Then I tried out the command /restart and it stopped the server too. It seems this is a Paper issue since I’ve seen some other people complain about this too. How to make restarts work again?
(btw. my host runs on linux, I have 5376MB ram if that helps. I’m really new to Paper)

Root access
Use the following script to boot your server.

while true;
do
  java <flags> -jar <file>
  echo "Server fully stopped. Press Ctrl-C to abort restart."
  sleep 2
done

Then use a cronjob that restarts the server at said time (for example daily).
When I’ve hosted a server I’ve used tmux as a tile manager so I simply sent a stop via tmux and used the script above.

@daily <script-to-restart.sh>

Minecraft panel
Most panels has a scheduling tab where you can schedule restarts.

Hey, I tried the first one and it totally didn’t work, the server still stopped. The Minecraft panel schedule restart stops the server too. I told you this is unfortunetaly not my issue but a Paper one and I don’t know how to fix it.

How did you implement the script I wrote above?

I created a start.sh script

while true;
do
java -Xms5376M -Xmx5376M -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs -jar paperclip.jar
echo “Server fully stopped. Press Ctrl-C to abort restart.”
sleep 2
done

, put it into the directory where the paper jar is, changed it to restart-script: ./start.sh, turned the server off and on again and the /restart command and Minecraft Server panel harmonograms didn’t work, stopped the server

Oh so you’re using a shared host or similarly? My example was for a root server where you boot the actual server with the script above and use a cronjob to stop the server, it wont work for what you’re trying to do.

I’m not sure of the status of the restart-script but maybe @electronicboy can help out? :slight_smile:

Yep, I’m using a shared host.

restart-script is not supported at all on shared hosts;

  1. Any shared host which actually enforces memory limits will completely break this mechanism due to how it works
  2. Restarting using this manner will break your control panel access in the majority of cases due to how it starts up the server jar (Even on a standard self-hosted setup, you need to consider how this will actually work)
  3. A while true loop in the restart script is purely broken, you’ll have the server trying to run the startup script which will try to start a server, and when the original server closes, if if was running from that script, it will also try to run the server again ( I do recommend using a while true loop over any control panels, etc; However; that’s not always possible)

Automated restarting when you’re using some form of management system is 100% down to the management system, e.g. the panel and it’s daemon, if it doesn’t support this, you’ll have to find an alternative provider who offers the feature you need for this

1 Like