Skip to content
PN Scripts

Games

Scheduled restarts for a Paper Minecraft server: warnings, saving and coming back up

  • PN Scripts
  • 9 min read

A Minecraft server that has been up for a week is often slower than the same server after a restart, and a daily restart at a quiet hour is the usual fix. Done badly, it is also the most common reason players log in angry: they were kicked in the middle of a build without a word, the server did not come back until someone noticed in the morning, or the restart ran twice on the night the clocks went back. This guide covers what a good scheduled restart does, in order: when to run it, how to warn players, what saves the world, and what brings the server back. The examples are for Paper on Linux; the Python sample and the shell script were run as printed, and the systemd unit passed systemd's own check.

#Why restart at all

Plugins and long sessions accumulate state: caches that grow, scheduled tasks that pile up, chunks that stay loaded. A restart clears all of it, applies updated plugins and configuration, and gives you a known point each day to take a backup. It is not a cure for a server that is too small or a plugin that leaks memory, but it keeps a healthy server healthy. Once a day at the quietest hour is enough for most community servers; busy servers sometimes add a second one in the afternoon.

#Pick a time that exists every day

The quietest hours are often between 03:00 and 05:00, which is exactly when the clocks change in most of Europe. In Bulgaria, on the last Sunday of March the clock jumps from 03:00 to 04:00, and on the last Sunday of October it goes back from 04:00 to 03:00. A restart set for 03:30 therefore does not happen at all one night in spring, and happens twice one night in autumn. This sample shows it for 2026:

from datetime import date, datetime, time, timezone
from zoneinfo import ZoneInfo

SOFIA = ZoneInfo("Europe/Sofia")


def restart_instants(day: date, at: time, tz=SOFIA):
    """Every real moment the wall clock shows `at` on `day`: none, one or two."""
    found = {}
    for fold in (0, 1):
        utc = datetime.combine(day, at, tzinfo=tz).replace(fold=fold).astimezone(timezone.utc)
        local = utc.astimezone(tz)
        if (local.date(), local.time()) == (day, at):  # the time really exists that day
            found[utc] = local
    return list(found.values())


for day in (date(2026, 3, 29), date(2026, 10, 25)):
    for at in (time(3, 30), time(4, 0)):
        moments = restart_instants(day, at)
        print(day, at, len(moments), [m.isoformat() for m in moments])

It prints no moment for 03:30 on 29 March, two for 03:30 on 25 October (once at +03:00 and once at +02:00, an hour apart), and exactly one for 04:00 on both days. So either pick a time outside 03:00 to 04:00, such as 04:00 or 05:00, or use a scheduler that knows what to do with the missing and the repeated hour. Comparing the two moments by their UTC time matters: Python treats two times in the same zone as equal when their wall clocks are equal, even when they are an hour apart.

Also set the time zone explicitly. A server rented in Germany or the United States may run on UTC, and "04:00" in its configuration is then 06:00 or 07:00 in Sofia, depending on the season.

#Warn people properly

A single chat message ten minutes before is missed by anyone who is busy. What works is a countdown that gets more insistent:

  • Chat messages at 30, 15, 10, 5, 3 and 1 minutes, then every few seconds at the end, each with a short sound.
  • A boss bar for the last five minutes that shows the exact time left, so nobody needs to scroll the chat.
  • A title in the middle of the screen for the last minute.
  • The player's own language. On a Bulgarian server half the players may have the game in English and half in Bulgarian; the warnings should follow each player's setting.
  • No burst after lag. If the server stalls for twenty seconds, players should see one warning with the true time left, not five stale ones at once.
  • No countdown to an empty server. If nobody is online, restart straight away.

#Save, kick, stop

The stop command saves all changes to disk and then shuts the server down, so the world is safe as long as the server stops normally rather than being killed. A good sequence is still worth keeping: about ten seconds before the end run save-all and any other console commands your plugins need (a backup trigger, a message to a Discord channel), then disconnect every player with a friendly message such as "Daily restart, back in a minute", then run stop. Kicking first means nobody loses an item in the last second because they were still in the middle of moving it.

What you should never do is end the Java process with kill -9 or a panel's "kill" button. That skips the save, and whatever happened since the last autosave is gone.

#Bring the server back

A plugin can stop a server, but something outside it has to start it again. There are three common ways.

A hosting panel. Pterodactyl and most Minecraft hosts start the server again when it stops. Check this once on a quiet evening with stop, before you rely on it at four in the morning.

A start script that loops. On your own machine, run the server from a script that starts it again whenever it stops:

#!/bin/sh
# Start Paper again whenever it stops. Ctrl+C during the pause ends the loop.
cd /opt/minecraft
while true; do
  java -Xms4G -Xmx4G -jar paper.jar nogui
  echo "Server stopped at $(date '+%H:%M:%S'); starting again in 10 seconds. Press Ctrl+C to quit."
  sleep 10
done

Run it in a screen or tmux session so you can reach the console. Paper's spigot.yml has a restart-script setting, ./start.sh by default, that its restart system runs; with a loop like this you do not need it. Note that the restart-on-crash setting next to it only applies when Paper's watchdog kills a frozen server, not when the operating system kills the process.

A systemd service. On a Linux server, a service that is always restarted is the most robust choice, because it also starts the server after a reboot:

[Unit]
Description=Minecraft Paper server
After=network-online.target
Wants=network-online.target

[Service]
User=minecraft
WorkingDirectory=/opt/minecraft
ExecStart=/usr/bin/java -Xms4G -Xmx4G -jar paper.jar nogui
Restart=always
RestartSec=10
SuccessExitStatus=0 143
TimeoutStopSec=90

[Install]
WantedBy=multi-user.target

Restart=always starts it again however it ended, RestartSec gives it a pause, SuccessExitStatus counts the Java exit code after a normal stop signal as success, and TimeoutStopSec gives a large world time to save before systemd gives up. Paper 26 needs Java 25, so check that /usr/bin/java is that version.

#Between restarts

The same plugin that counts down is a good place for a few rotating announcements: the rules, the Discord link, the vote reminder, one every ten minutes, in each player's language, and not sent to an empty server. Staff also need a way to act: start a restart in five minutes after a plugin update, delay the nightly one during an event, cancel a countdown or skip one night.

#A plugin that does all of this

We made Belfry, a Paper plugin that restarts the server on a schedule: any number of daily times in one time zone, on every day or chosen days, with a time inside the spring gap moved forward and a time repeated in autumn run once. It warns in chat with a bell, shows a boss bar for the last minutes and a title for the last one, in each player's language (English or Bulgarian), skips the countdown when nobody is online, runs save-all or any console commands before the stop, kicks players with a message and stops the server for your host or script to start again. Staff commands start, delay, cancel or skip restarts, an optional low-TPS check can start one, and rotating announcements run between restarts. It needs Paper 26.1 or newer with Java 25 and was tested with an automated suite on MockBukkit with the Paper 26.2 API, not on a live server. It is listed as Coming soon.

#Frequently asked questions

How often should a Minecraft server restart?

Once a day at the quietest hour suits most community servers. Busy or heavily modded servers sometimes restart twice a day; a server that needs it more often has a problem a restart only hides.

Does /stop save the world?

Yes. It saves all changes to disk and then shuts the server down. Killing the Java process instead skips the save.

Why did my server not come back after a restart?

Because nothing started it again. A plugin can only stop the server; the hosting panel, a start script that loops or a systemd service with Restart=always has to start it.

Why did my restart run twice, or not at all, one night?

Because it was set inside the hour the clocks change. In Bulgaria 03:00 to 04:00 is skipped in spring and repeated in autumn; choose 04:00 or later, or a scheduler that handles both cases.

#Sources

Keep reading

Keep reading

Comments

Comments

Be the first to leave a comment.

Leave a comment

Next step

pnscripts.com/contact

Talk to the team

Ask about an article, or tell us about a project you want built. We reply within one business day.

Write to us

The PN Scripts family

Other PN Scripts sites

Hosting, games and the blog each have their own site, run by the same company.

  • pnscripts.com

    PN Scripts

    Software engineering

    Custom web, mobile, API and game development, plus our open-source products and plugins.

  • games.pnscripts.com

    Games

    Games and game servers

    The home for PN Scripts games: free browser games you can play right now, with game servers coming soon.

  • hosting.pnscripts.com

    Hosting

    Hosting and infrastructure

    Shared hosting, KVM VPS, dedicated servers and domains, from the same company that builds your project.

  • blog.pnscripts.com

    Blog

    Articles and field notes

    Practical articles on software development, hosting, open source and games, written by the people who build them.

    You are here