Skip to main content
Server Admin

How to Schedule Server Tasks in Minecraft (Cron & Plugins)

Learn how to schedule server tasks in Minecraft using Linux cron jobs, systemd timers, and in-game plugins. Automate restarts, backups, broadcasts, and more.

5 min read8 sectionsJava & Bedrock1.21

Why Schedule Server Tasks?

A well-run Minecraft server automates everything it can. Restarts, backups, broadcast messages, world saves, lag-clearing entity sweeps, none of these should require an admin to be online typing commands. When you schedule server tasks in Minecraft properly, the server runs itself 24/7 and your players get a consistent, reliable experience without any manual intervention.

There are two main approaches: operating-system-level scheduling with cron or systemd timers, and in-game plugin schedulers. Most production servers use both, cron for system-level operations like backups and restarts, and plugins for in-game tasks like broadcasts and mob clearing.

Linux Cron Jobs for Minecraft

Cron is the traditional Unix task scheduler and it works perfectly for Minecraft server management. Every Linux distribution includes it. Edit your crontab with crontab -e and add entries in this format:

# ┌───── minute (0-59)
# │ ┌───── hour (0-23)
# │ │ ┌───── day of month (1-31)
# │ │ │ ┌───── month (1-12)
# │ │ │ │ ┌───── day of week (0-7, 0 and 7 are Sunday)
# │ │ │ │ │
# * * * * * command

Example: Automated Backups Every 4 Hours

This cron job saves the world and copies it to a backup directory. See the backup automation guide for a full walkthrough.

# Save world and back up every 4 hours
0 */4 * * * tmux send-keys -t minecraft "save-all" Enter && sleep 10 && tar -czf /backups/mc-$(date +\%Y\%m\%d-\%H\%M).tar.gz -C /opt/minecraft world

Example: Scheduled Restart at 4 AM

Pair this with an auto-restart setup so the server comes back up automatically:

# Warn players, then restart at 4:00 AM daily
58 3 * * * tmux send-keys -t minecraft "say Server restart in 2 minutes!" Enter
0  4 * * * tmux send-keys -t minecraft "stop" Enter

Example: Clear Lag Every 15 Minutes

*/15 * * * * tmux send-keys -t minecraft "kill @e[type=item]" Enter

This removes all dropped item entities every 15 minutes. For a more player-friendly approach, send a warning 30 seconds before and use a plugin instead (see below).

systemd Timers as a Cron Alternative

If you already manage your server with systemd (recommended in our headless guide), you can use systemd timers instead of cron. They offer better logging and dependency management.

Create a timer unit at /etc/systemd/system/mc-backup.timer:

[Unit]
Description=Minecraft backup timer

[Timer]
OnCalendar=*-*-* 00/4:00:00
Persistent=true

[Install]
WantedBy=timers.target

And a corresponding service unit at /etc/systemd/system/mc-backup.service:

[Unit]
Description=Minecraft world backup

[Service]
Type=oneshot
User=minecraft
ExecStart=/opt/minecraft/backup.sh
sudo systemctl daemon-reload
sudo systemctl enable mc-backup.timer
sudo systemctl start mc-backup.timer

Check upcoming runs with systemctl list-timers.

Plugin-Based Task Scheduling

For tasks that need to interact with the game world, broadcasting messages, clearing mobs with a countdown, running commands at specific in-game times, plugins are the better choice because they have direct access to the Minecraft API.

EssentialsX Built-in Scheduler

If you already run EssentialsX, you have a built-in task scheduler. Edit plugins/Essentials/config.yml:

scheduler:
 - command: "broadcast &6Server restart in 10 minutes!"
   delay: 0
   period: 21600    # every 6 hours (in seconds)
 - command: "broadcast &aTip: Use /sethome to save your location!"
   delay: 300
   period: 1800     # every 30 minutes

Dedicated Scheduler Plugins

For more control, consider dedicated scheduling plugins:

  • CraftScheduler, lightweight cron-like scheduling with in-game time support and per-world configuration
  • Autobroadcaster, specifically for rotating broadcast messages with configurable intervals
  • LagAssist, combines entity clearing, redstone limiting, and TPS-based automatic actions into one plugin

A typical CraftScheduler config for a schedule server tasks minecraft setup looks like:

tasks:
  clear-items:
    commands:
     - "say &cClearing dropped items in 30 seconds..."
     - "delay 30"
     - "kill @e[type=item]"
     - "say &aDropped items cleared!"
    interval: "15m"
  daily-restart:
    commands:
     - "say &eServer restarting in 60 seconds..."
     - "delay 50"
     - "say &cRestarting in 10 seconds!"
     - "delay 10"
     - "stop"
    time: "04:00"

Combining Cron and Plugins Effectively

The best approach to schedule server tasks in Minecraft is to use each tool for what it does best:

  • Cron / systemd timers, backups, server restarts, log rotation, external scripts, system-level monitoring
  • Plugins, in-game broadcasts, entity clearing with countdowns, time-based events, anything that needs to read game state

Avoid duplicating tasks across both systems. If a plugin handles mob clearing with a countdown, do not also run a cron job that kills entities, they will conflict and confuse players.

Sending Commands from Outside the Server

All cron-based scheduling relies on your ability to send commands to the running server process. The method depends on your setup:

# tmux
tmux send-keys -t minecraft "your-command" Enter

# screen
screen -S minecraft -X stuff "your-command$(printf '\r')"

# RCON (works remotely too)
mcrcon -H localhost -P 25575 -p your_password "your-command"

RCON is especially useful because it works over the network, so you can schedule server tasks in Minecraft from a separate management server or a CI/CD pipeline. Enable it in server.properties:

enable-rcon=true
rcon.port=25575
rcon.password=a-strong-random-password

Summary

Use Linux cron or systemd timers for system-level tasks like backups and restarts, and use plugins for in-game automation like broadcasts and entity clearing. Send commands to your server via tmux, screen, or RCON. The combination gives you a fully automated server that runs itself around the clock.

Want managed hosting instead? Astroworld Hosting handles auto-restarts, updates, and backups for you.

Questions about Schedule Server Tasks

Why would you set up Schedule Server Tasks at all?

Restarts, backups, broadcast messages, world saves, lag-clearing entity sweeps, none of these should require an admin to be online typing commands.

What are the numbers behind Schedule Server Tasks?

When you schedule server tasks in Minecraft properly, the server runs itself 24/7 and your players get a consistent, reliable experience without any manual intervention.

Which command does Schedule Server Tasks use?

Create a timer unit at /etc/systemd/system/mc-backup.timer: And a corresponding service unit at /etc/systemd/system/mc-backup.service: Check upcoming runs with systemctl list-timers. This guide uses /etc/systemd/system/mc-backup.timer.

What should you avoid while doing Schedule Server Tasks?

If a plugin handles mob clearing with a countdown, do not also run a cron job that kills entities, they will conflict and confuse players.

How to Schedule Server Tasks in Minecraft (Cron & Plugins): Learn how to schedule server tasks in Minecraft using Linux cron jobs, systemd timers, and in-game plugins. Automate restarts, backups, broadcasts, and more.
How to Schedule Server Tasks in Minecraft (Cron & Plugins), from the Server Admin guides on Astroworld.

Blocks and items in this guide

Redstone in MinecraftRedstoneTarget in MinecraftTarget

All 2 of these are named in the Schedule Server Tasks guide above, starting with Redstone. Look them up in the item database.

More guides on this site

More Server Admin Guides

Related Tools & Databases