Stop cron from nuking your server during business hours
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop cron from nuking your server during business hours
🧩 The Challenge
You know that feeling when the database starts crawling at 10 AM because a junior dev set a massive log-cleanup script to run every hour on the hour? I’ve spent too many mornings hunting down why everything spiked at the exact same time.
💡 The Fix
Use the random delay feature in systemd timers instead of the rigid, predictable mess that is standard crontab. It spreads the load so your server doesn’t hit a wall all at once.
[Timer]
OnCalendar=daily
RandomizedDelaySec=3600
AccuracySec=1us
⚙️ Why It Works
Setting a RandomizedDelaySec forces the service to wait for a random interval within that window before firing, which prevents a thundering herd of jobs from choking your CPU at midnight or the top of the hour. It’s an easy win for keeping latency spikes away from your production apps.
🚀 Pro-Tip: Pair this with a lower CPU weight in your unit file to make sure the task doesn’t steal cycles from your actual web traffic.
Linux Tips & Tricks | © ngelinux.com | 9/13/2026
