How to schedule one-time tasks with at

· Category: Linux

Short answer

at schedules a command to run once at a specified future time.

Steps

  1. Schedule a task:
echo 'backup.sh' | at 02:00
  1. List pending jobs:
atq
  1. Remove a job:
atrm 1
  1. Schedule with relative time:
echo 'reboot' | at now + 30 minutes

Tips

  • Ensure the atd service is running.
  • Output is mailed to the user by default; redirect to a file.
  • batch runs tasks when system load is low.

Common issues

  • at not installed on minimal systems; install at package.
  • Environment variables differ from interactive shell; set explicitly.