Site icon New Generation Enterprise Linux

Stop systemd timers from clobbering your system with overlapping runs

Cron & Task Scheduling (Cron/Systemd Timers/At)

Stop systemd timers from clobbering your system with overlapping runs

đź§© The Challenge

You finally moved your backups to a systemd timer, but then a massive database dump hung and the next scheduled run kicked off anyway. Now you have two processes fighting over the same IO and disk space, and everything has slowed to a crawl.

đź’ˇ The Fix

Just add the Conflicts directive to your service unit. It forces the current task to shut down its predecessor before firing up, keeping your resource usage sane.

[Unit]
Conflicts=backup-database.service

[Service]
ExecStart=/usr/local/bin/backup-script.sh

⚙️ Why It Works

Setting this makes the timer unit perform a mutual exclusion dance. If one instance is still grinding away, the systemd scheduler forces the old one to quit before the new one starts, preventing the dreaded “runaway process pile-up.”

🚀 Pro-Tip: Always check your journal logs with -u for that specific unit if you see exit code 143, that’s just the SIGTERM you sent it doing its job.

Linux Tips & Tricks | © ngelinux.com | 8/8/2026

0 0 votes
Article Rating
Exit mobile version