Welcome to

FPSmeter

Analyze your game servers’ performance in real time with precision and reliability.

Tutorial: Realtime Script to Improve Game Server Stability

Here’s a bash script called realtime.sh that switches your game servers to realtime mode. It significantly improves the overall stability of HLDS/SRCDS-based servers, including:

  • Counter-Strike
  • Left 4 Dead
  • Day of Defeat
  • Team Fortress

✅ Fully compatible with Counter-Strike: Global Offensive and Counter-Strike 2.


🔧 What does this script do?

The realtime.sh script leverages the Linux realtime scheduling system to assign higher CPU priority to critical processes — like your game servers.

  • Detects running server processes (e.g., srcds_linux, cs2, etc.)
  • Applies realtime priority using chrt -f -p
  • Also optimizes internal kernel timer processes

🎯 Result: the OS gives your game server top CPU priority, reducing latency and micro-lags.


📈 Does it increase FPS?

Indirectly, yes. This script doesn’t generate more FPS, but it stabilizes the frame rate and reduces OS multitasking slowdowns.
➕ Less fluctuation ➝ Smoother experience ➝ Happier players.


⚙️ Installation & usage

  1. Create the file:
    nano /home/realtime.sh
  2. Paste in the following content:
    #!/bin/sh
    PROCESS_NAMES="srcds_linux srcds_i686 srcds_i486 srcds_amd hlds_i686 hlds_i486 hlds_amd cs2"
    for name in $PROCESS_NAMES; do
    PIDS=$(pidof $name)
    for p in $PIDS; do
    chrt -f -p 98 $p
    done
    done
    # Optimisation supplémentaire pour noyaux RT
    PIDS=$(ps ax | grep sirq-hrtimer | grep -v grep | awk '{print $1}')
    for p in $PIDS; do
    chrt -f -p 99 $p
    done
    PIDS=$(ps ax | grep sirq-timer | grep -v grep | awk '{print $1}')
    for p in $PIDS; do
    chrt -f -p 51 $p
    done
  3. Make it executable:
    chmod 755 /home/realtime.sh
  4. Add it to cron to run every 5 minutes:
    sudo nano /etc/crontab
    Append this line:
    */5 * * * * root /home/realtime.sh > /dev/null 2>&1

✅ That’s it! Your servers will now run with higher scheduling priority automatically.


⏱️ Bonus tip: change the system clock source

Linux uses a system clocksource for timing. By default, it’s usually tsc, which can be unstable on some CPUs.
You can test a more stable source like hpet or acpi_pm:

  • Show available clock sources:
    cat /sys/devices/system/clocksource/clocksource0/available_clocksource
  • See the current clock source:
    cat /sys/devices/system/clocksource/clocksource0/current_clocksource
  • Temporarily switch to hpet:
    echo hpet | sudo tee /sys/devices/system/clocksource/clocksource0/current_clocksource

ℹ️ This change is temporary and will reset after reboot. For a permanent change, edit your GRUB boot line.


🎉 Congratulations! You’ve taken a major step toward a more stable and professional game server. Don’t hesitate to share this tip with fellow admins to improve multiplayer experiences.


- ✍️ Written on: 26/06/2025 à 20h00
- 🔄 Last updated on: 26/06/2025 à 20h00
- 🧠 Author: Slymer  | Idée originale par : BehaartesEtwas
- 💬 Community discussion: View the conversation