Never Miss a Game Patch Again: Systemd Timers and Cron for Hands-Free Server Updates

Every game server admin knows the dread of waking up to a Discord full of “server is outdated” messages. A mandatory patch dropped at 3 AM, and your community is locked out until you manually run SteamCMD. The fix is automation — systemd timers or cron jobs that handle updates, restarts, and verification without human intervention. This article covers both approaches, with working scripts for SteamCMD-based games and graceful player notification.

If you are setting up automation on a new machine, compare dedicated server hardware to ensure your CPU and storage can handle updates without disrupting active gameplay.

Why Manual Updates Don’t Scale

Game updates fall into three categories. Mandatory patches break the network protocol — outdated servers cannot accept connections. These must be applied within hours. Optional updates include bug fixes and balance changes; they can wait 24–48 hours. Server-only updates (mods, plugins, configs) are on your schedule. Automation handles the mandatory ones before your players notice. Without it, you either wake up at odd hours or leave your community stranded.

Systemd Timers: The Modern Approach

Systemd timers are preferred on Ubuntu 16.04+, Debian 8+, and CentOS 7+. They offer better logging, dependency management, and integration with systemd services than cron.

Step 1: The Update Script

#!/bin/bash
# /usr/local/bin/update-game-server.sh
set -euo pipefail

SERVER_NAME="$1"
APP_ID="$2"
INSTALL_DIR="/opt/game-servers/$SERVER_NAME"
LOG_FILE="/var/log/game-updates/$SERVER_NAME.log"

mkdir -p "$(dirname "$LOG_FILE")"

# Stop the server before updating
systemctl stop "$SERVER_NAME" || true

# Run SteamCMD update
/usr/games/steamcmd +force_install_dir "$INSTALL_DIR" \
  +login anonymous \
  +app_update "$APP_ID" validate \
  +quit >> "$LOG_FILE" 2>&1

# Start the server after update
systemctl start "$SERVER_NAME"

echo "$(date): $SERVER_NAME updated (app $APP_ID)" >> "$LOG_FILE"

Step 2: Timer and Service Units

# /etc/systemd/system/palworld-update.timer
[Unit]
Description=Palworld server update timer
Requires=palworld-update.service

[Timer]
OnCalendar=*-*-* 04:00:00
RandomizedDelaySec=300
Persistent=true

[Install]
WantedBy=timers.target

# /etc/systemd/system/palworld-update.service
[Unit]
Description=Palworld server update

[Service]
Type=oneshot
ExecStart=/usr/local/bin/update-game-server.sh palworld 2394010
User=steam
Group=steam

Enable and start: sudo systemctl daemon-reload && sudo systemctl enable palworld-update.timer && sudo systemctl start palworld-update.timer. The server updates daily at 4:00 AM with a randomized 5-minute delay. Persistent=true ensures the update runs immediately if the machine was offline at the scheduled time.

Cron: Simple and Universal

For systems without systemd or for simpler setups, cron works everywhere:

# Edit the crontab for the steam user
sudo crontab -u steam -e

# Palworld update at 4:00 AM daily
0 4 * * * /usr/local/bin/update-game-server.sh palworld 2394010

# 7 Days to Die update at 5:00 AM daily
0 5 * * * /usr/local/bin/update-game-server.sh 7dtd 294420

Cron is simpler but lacks systemd’s logging integration and dependency management. Use flock to prevent overlapping runs: flock -n /tmp/palworld-update.lock /usr/local/bin/update-game-server.sh ...

SteamCMD App IDs for Popular Games

GameSteam App IDUpdate CadenceDownload Size
Palworld2394010Weekly–monthly15+ GB
Valheim896660Monthly–quarterlySmall patches
7 Days to Die294420MonthlyAlpha/beta branches
Rust258550Monthly (forced wipe)First Thursday
ARK: SA2430930Weekly–monthly40+ GB per map
Enshrouded2278520MonthlyModerate
Project Zomboid380870Monthly–quarterlySmall patches
CS2730WeeklyUse srcds_run
Sons of the Forest2465200MonthlyModerate

Graceful Restarts: Don’t Kick Players Mid-Game

A hard restart during an update abruptly kicks players. Use RCON to send warnings before shutdown:

#!/bin/bash
# Graceful restart with player warnings
SERVER_NAME="palworld"
RCON_PORT=25575
RCON_PASS="your-rcon-password"

echo "Broadcast: Server restarting in 5 minutes for update" | rcon -a 127.0.0.1:$RCON_PORT -p $RCON_PASS
sleep 240
echo "Broadcast: Server restarting in 60 seconds. Save your progress!" | rcon -a 127.0.0.1:$RCON_PORT -p $RCON_PASS
sleep 60
echo "Broadcast: Server restarting NOW" | rcon -a 127.0.0.1:$RCON_PORT -p $RCON_PASS

systemctl stop "$SERVER_NAME"
/usr/local/bin/update-game-server.sh "$SERVER_NAME" 2394010

Post-Update Verification

After each update, confirm the server started correctly:

#!/bin/bash
# Post-update health check
SERVER_NAME="$1"

if pgrep -f "$SERVER_NAME" > /dev/null; then
  echo "$(date): $SERVER_NAME is running after update"
else
  echo "$(date): ERROR - $SERVER_NAME failed to start after update"
  systemctl restart "$SERVER_NAME"
  # Alert via webhook
  curl -s -X POST "https://discord.com/api/webhooks/YOUR_WEBHOOK" \
    -H "Content-Type: application/json" \
    -d "{\"content\":\"$SERVER_NAME failed to start after update\"}"
fi

Stagger Updates for Multi-Game Servers

If you run multiple game servers on one machine, stagger the update times to avoid saturating the network link and disk I/O. A sample schedule: Palworld at 4:00 AM, Valheim at 4:30 AM, Minecraft at 5:00 AM, 7 Days to Die at 5:15 AM. Use RandomizedDelaySec=300 in systemd timers or a random sleep in cron to spread the load further.

Testing Before Production

  • Run the update script manually: sudo /usr/local/bin/update-game-server.sh palworld 2394010
  • Check the log: cat /var/log/game-updates/palworld.log
  • Trigger the timer manually: sudo systemctl start palworld-update.service
  • Verify the server starts and players can connect
  • Simulate a failed update by removing SteamCMD and confirm the alert fires

Bottom Line

Automating game server updates with systemd timers or cron eliminates the most common maintenance burden of self-hosted game hosting. Systemd timers are the recommended approach for modern Linux, offering better logging and integration. Cron is simpler and works everywhere. Pair automation with graceful shutdown notices and post-update verification, and your community will never see another “server outdated” message.

Review our dedicated server hosting options to find a machine with enough storage and bandwidth for unattended game updates.

Leave a Reply