1. Task Scheduling — Overview

Why Schedule Tasks?

You schedule tasks when you need a command or script to run at a specific time without being logged in. Common use cases:

Two Scheduling Tools

Tool Service Name Use Case Repeats?
at atd (atd.service) Run a task once at a specific time No — runs once then removes itself
cron crond / cron (cron.service) Run a task on a repeating schedule Yes — repeats on a defined schedule

2. The at Command (One-Time Tasks)

Basic Usage

at 3pm                     # schedule for 3:00 PM today (or tomorrow if past)
at 3pm tomorrow            # schedule for 3:00 PM tomorrow
at 2:00am Friday           # schedule for 2:00 AM on Friday
at now + 1 minute          # schedule for 1 minute from now
at now + 5 minutes         # schedule for 5 minutes from now
at midnight                # schedule for midnight (12:00 AM)
at noon                    # schedule for 12:00 PM
at teatime                 # schedule for 4:00 PM

After typing the time and pressing Enter, a prompt (at>) appears. Type each command on its own line. When done, press Ctrl+D to save and exit.

Example:

$ at 3am
at> pwd
at> ls
at> echo "test"
at> (press Ctrl+D)

Listing Scheduled at Jobs

at -l                      # list all pending at jobs
atq                        # same as at -l

Output shows: job number, scheduled time, user who created it.

Removing an at Job