Running one-off tasks without the clutter of crontab

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

Running one-off tasks without the clutter of crontab

🧩 The Challenge

Sometimes you need to run a maintenance script exactly once at 3 AM but you don’t want to go through the hassle of adding a line to a crontab that you’ll just forget to delete later. I’ve spent too many Sunday mornings cleaning up stale cron jobs that were supposed to be “temporary.”

💡 The Fix

Use the at command to queue a job for a single execution and let the system handle the cleanup once it’s done. It’s essentially a fire-and-forget task scheduler for when you don’t want to leave a permanent mark on the system.

echo "/usr/local/bin/cleanup_temp_files.sh" | at 03:00 tomorrow

⚙️ Why It Works

Passing the command through standard input tells the at daemon to parse the time string and queue the job into its internal spool until the specified moment. Everything happens in the background, and once the task finishes, it effectively ceases to exist.

🚀 Pro-Tip: Run atq to check what’s in the queue before you accidentally schedule a server reboot at the wrong time.

Linux Tips & Tricks | © ngelinux.com | 7/14/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted