Managing One-Time Batch Tasks with the at Command

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

Managing One-Time Batch Tasks with the at Command

🧩 The Challenge

Scheduling a single, non-recurring task in cron is cumbersome because it requires manually deleting the job entry after execution. Standard cron entries are designed for recurring intervals rather than fire-and-forget operations.

💡 The Fix

Use the at command to queue a task for a specific future timestamp, which automatically discards the job once it has been processed.

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

⚙️ Why It Works

The at utility accepts commands from standard input and schedules them into a single-use queue managed by the atd daemon. This eliminates the need for manual cleanup of crontab files after a task completes.

🚀 Pro-Tip: Use the atq command to view your pending queue and atrm followed by the job ID to cancel a scheduled task before it runs.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted