Skip to main content
Or imagine logs slowly filling up the disk until services suddenly stop working. Without a reliable scheduling mechanism, critical maintenance tasks depend on memory and manual execution — and that creates outages. This guide shows how to schedule jobs so important tasks run automatically and on time, even when no one is watching. This article begins with scheduling one-time jobs using tools like at. It then covers recurring jobs with cron, explores systemd timers as a modern integration option, and finishes with managing temporary files on Red Hat Enterprise Linux 10. By the end, you’ll know how to make maintenance and cleanup tasks run reliably, on schedule, and with predictable environment settings.
A dark-themed presentation slide titled "Overview" with bullet points about task scheduling, including using the at command, cron for recurring jobs, and systemd timers. The slide also mentions managing temporary files and automating cleanup tasks.

When you need one-time scheduled execution

Sometimes you need to run one or more commands at a specific point in time. Examples:
  • A user schedules a long-running maintenance task to run overnight.
  • An administrator queues a safety job to reset firewall settings in ten minutes.
  • You want a one-off backup or data migration to run at a future date.
For one-time scheduled execution, at is a simple and widely available utility. It accepts commands or scripts and runs them once at a specified future time.
  • at queues the job: the provided commands are saved into a spool directory.
  • atd (the at daemon) monitors that spool directory. When the scheduled time arrives, atd executes the job and then removes it from the queue.
  • Important: at creates the job entry; atd performs the execution.
A dark-themed presentation slide titled "Scheduling One-Time Jobs" with a calendar icon in the center. The caption reads: "A scheduling utility that runs a command once at a specified future time."

How at jobs run and common pitfalls

  • at jobs execute in a non-interactive shell (usually /bin/sh), not your interactive bash session.
  • Profiles and interactive shell configuration files (for example .bashrc or .profile) are not sourced.
  • Environment variables, aliases, and PATH modifications from your interactive session are not available to at jobs unless you explicitly provide them.
A dark-themed infographic titled "How It Works" with five numbered gear icons illustrating a job scheduling workflow. It shows steps: schedule a job, save the command in a spool directory, the atd daemon monitors it, atd executes the job at the scheduled time, and the job is then removed.
When creating at jobs, always use absolute paths for executables and file locations (for example, /usr/bin/rsync or /home/student/myjob). If your job depends on environment variables, set them explicitly in the job’s text.
A dark-themed "Important Information" panel with three cards, each showing a blue outline icon. The cards give shell-related tips: "'at' jobs run in a non-interactive shell," interactive settings like ".bashrc" or aliases may not load, and use absolute paths to avoid command failures.

Practical demo — scheduling one-time jobs with at

Follow these steps to schedule and manage one-time at jobs:
  1. Verify the atd service is running:
    • systemctl status atd
  2. Queue a job using at with a time specification:
    • Examples: 16:30, 10:00 tomorrow, 14:00 2026-05-01, 8:00 May 2
  3. List pending jobs: atq
  4. View a job’s contents: at -c <jobid>
  5. Remove a queued job: atrm <jobid>
Summary of common commands: Example interactive session (the at prompt requires entering the job content and finishing with Ctrl-D):
Inspect a queued job:
Remove a job from the queue:
This demonstrates how at lets you schedule precise, one-time command execution. To ensure reliable runs:
  • Use absolute paths for binaries and target files.
  • Export or set any required environment variables inside the job text.
  • Test the commands in a non-interactive shell if possible (for example, sh -c '...command...') to verify behavior matches what atd will run.
Because at jobs run in a non-interactive shell, commands that rely on environment settings, interactive prompts, or unlocked credentials may fail. Always test jobs and provide explicit environment configuration.
Next: recurring jobs with cron, and using systemd timers for tighter integration with services.

Watch Video