Game servers ·
Restart your game server automatically with schedules
Use schedules in the panel to restart your game server every night, warn players first and make a daily backup. With cron-style times in UTC explained.
A game server that runs for days on end tends to get slower. A nightly restart keeps it fresh, and with a schedule you do not have to get up for it. This guide explains how schedules work and builds two of them: a nightly restart with a warning for your players, and a daily backup.
How schedules work
A schedule has two parts:
- A time: when the schedule runs, written as five cron-style fields.
- One or more tasks: what happens at that time. Tasks run one after another, in the order you added them.
There are three kinds of task:
| Action | What it does | Payload |
|---|---|---|
| Send command | Types a command into the server console | The command, for example say hi |
| Power signal | Starts or stops the server | start, stop, restart or kill |
| Create backup | Makes a backup of the server files | Optional: files to leave out |
All times are in UTC, not in your local time. 04:00 UTC is 05:00 in Central European winter time and 06:00 in summer time.
The time fields
| Field | Allowed values |
|---|---|
| Minute | 0 to 59 |
| Hour | 0 to 23 |
| Day of month | 1 to 31 |
| Month | 1 to 12 |
| Day of week | 0 to 7, where 0 and 7 are both Sunday |
In every field you can use:
*for "any".- A list such as
1,15. - A range such as
1-5. - A step such as
*/6, which in the Hour field means every 6 hours.
The Presets fill in the fields for you: Every minute, Hourly, Daily at 00:00 and Weekly (Sun).
Example 1: restart every night with a warning
This schedule runs at 04:00 UTC, warns your players twice and then restarts the server.
Create the schedule
- Sign in to the panel, open Game Servers and click your server.
- Click Schedules and then Create schedule.
- Under Name, enter "Nightly restart".
- Click the preset Daily at 00:00 and change Hour to
4. - Leave Active switched on and switch on Only when online. The schedule is then skipped when the server is stopped, so a server you switched off on purpose stays off.
- Click Create.
Add the tasks
Click the new schedule to open it. For each task, click Add task, fill in the fields and click Add.
| # | Action | Payload | Time offset (seconds) |
|---|---|---|---|
| 1 | Send command | say Server restarts in 5 minutes | 0 |
| 2 | Send command | say Server restarts in 1 minute | 240 |
| 3 | Power signal | restart | 60 |
Time offset (seconds) is the waiting time after the previous task, not after the start of the schedule. Task 2 runs 240 seconds after task 1, and task 3 another 60 seconds later. The maximum per task is 900 seconds.
The command say is from Minecraft. Other games use other commands for a message to all players, so check what your game expects. Enter the command exactly as you would type it in the console of your server. For Minecraft that means without a slash in front.
If a task fails
By default the schedule stops as soon as a task fails. Switch on Continue on failure for a task if the later tasks should still run. For a warning message that is a sensible choice: a failed message should not prevent the restart.
Example 2: a backup every day
- On the Schedules page, click Create schedule.
- Under Name, enter "Daily backup".
- Click the preset Daily at 00:00 and change Hour to
3. The backup then runs an hour before the restart from example 1 and the two do not overlap. - Leave Active switched on and click Create.
- Click the new schedule, then Add task.
- Under Action, choose Create backup.
- Leave Payload empty to back up everything. To leave files out, enter a pattern in gitignore style, for example
logs/. - Click Add.
Scheduled backups count toward the backup limit of your server. When the limit is reached, a new backup replaces the oldest one that is not locked. How to lock, download and restore backups is explained in Back up and restore your game server.
Test, pause and change a schedule
- Test: click the play icon (Run now) in the row of the schedule. All tasks run immediately, including the offsets. Run now ignores Only when online, so do not test a restart schedule while people are playing.
- Pause: edit the schedule and switch off Active. It keeps its tasks and shows Disabled in the list.
- Change: use the pencil icons to edit the schedule or a single task, and the bin icons to delete them. Deleting a schedule also removes all its tasks.
Each row shows when the schedule runs next, in the time zone of your device, so you can check that your time fields do what you meant.
Good to know
- Schedules do not run while the server is being installed or reinstalled, and not while it is suspended.
- A restart disconnects everyone. Pick a time when your server is quiet, and remember that the time is in UTC.
New to running a server? Start with How to set up a Minecraft server.