Stop your one-off scripts from polluting the system crontab
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop your one-off scripts from polluting the system crontab
🧩 The Challenge
You ever have a developer ask you to run a script just once at 3 AM to clear out a stuck database queue? I’ve spent way too many mornings clearing out long-forgotten single-use entries that someone left sitting in /etc/crontab forever.
💡 The Fix
Use the at utility instead, which handles the one-time job and then clears its own plate. It’s the cleaner way to deal with tasks that don’t need to haunt your server’s future.
echo "/usr/local/bin/cleanup_queue.sh" | at 03:00 tomorrow
⚙️ Why It Works
By piping the command into at, you’re creating a temporary queue entry that disappears as soon as it executes. It keeps your crontab pristine and prevents those “wait, why is this still running?” moments six months later.
🚀 Pro-Tip: Use atq to check if your scheduled job is actually in the queue before you head home.
Linux Tips & Tricks | © ngelinux.com | 10/25/2026
