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:
✅ Fully compatible with Counter-Strike: Global Offensive and Counter-Strike 2.
The realtime.sh
script leverages the Linux realtime scheduling system to assign higher CPU priority to critical processes — like your game servers.
srcds_linux
, cs2
, etc.)chrt -f -p
🎯 Result: the OS gives your game server top CPU priority, reducing latency and micro-lags.
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.
nano /home/realtime.sh
#!/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
chmod 755 /home/realtime.sh
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.
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
:
cat /sys/devices/system/clocksource/clocksource0/available_clocksource
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
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