Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

at

Run commands once at a later time (at), list (atq) or remove (atrm) those jobs, or run them when the load is low (batch).

Niveau
RHCSA-examen
Groep
Planning
Root nodig
Nee
Pakket
at
Ook
atq, atrm, batch

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

at TIME reads commands from the keyboard (end with Ctrl+D) or from a pipe, and the atd service runs them once at that time — with your user, your current folder and your environment.

Times can be clock times (16:30, 4pm, midnight), relative (now + 2 hours) or with a date (09:00 2026-12-31, noon tomorrow). Access is controlled by /etc/at.allow and /etc/at.deny.

Zo schrijf je het

at [-V] [-q QUEUE] [-f FILE] [-u USER] [-mMkv] TIME
at [-t [[CC]YY]MMDDhhmm[.ss]]
at -c JOB...
atq [-q QUEUE] [-o FORMAT]
atrm JOB...
batch

Opties 14

Meest gebruikt

-f FILE
Read the commands from a file.
-t TIME
Time in the form [[CC]YY]MMDDhhmm[.ss].
-l
List jobs (same as atq).
-r, -d
Remove jobs (same as atrm).
-c JOB
Show the full script of a job.
-b
Run when the load is low (same as batch).
-q QUEUE
Use a queue (a–z; later letters = nicer).
-m
Send mail when the job is done, even without output.
-M
Never send mail.
-u USER
The user for mail (root only).
-v
Show the run time before reading the job.
-k
Keep the environment of the job unchanged.
-o FORMAT
With atq: time format.
-V
Show the version.

Voorbeelden 11

$ als gewone gebruiker# als root (of met sudo)

  1. 1Install and start atd

    dnf install -y at
    systemctl enable --now atd

    Without atd nothing runs.

  2. 2Plan a command

    at 23:00
    at> systemctl restart httpd
    at> <EOT>
    job 3 at Sun Oct 25 23:00:00 2026

    Ctrl+D ends the input.

  3. 3Plan with a pipe

    echo "tar -czf /tmp/home.tgz /home/lisa" | at now + 2 hours

    No typing needed; good in scripts.

  4. 4List and inspect jobs

    atq
    3	Sun Oct 25 23:00:00 2026 a root
    at -c 3 | tail -3

    -c shows the environment and the commands.

  5. 5Remove a job

    atrm 3

    Use the number from atq.

  6. 6Run a script file at a time

    at -f /root/maintenance.sh 02:00 tomorrow

    The script runs with sh.

  7. 7Safety net for remote firewall changes

    echo "firewall-cmd --reload" | at now + 10 minutes

    If your new rule locks you out, the reload restores the permanent rules. Remove the job when all is fine.

  8. 8Run when the system is quiet

    echo "/usr/local/bin/reindex.sh" | batch

    Starts when the load drops under 0.8.

  9. 9Plan a reboot for the night

    echo "systemctl reboot" | at 03:00

    Same idea as shutdown -r 03:00.

  10. 10Block a user from at

    echo lisa >> /etc/at.deny

    Like cron.deny.

  11. 11Check for unknown at jobs (security)

    atq; ls -l /var/spool/at/

    Attackers can hide one-time jobs here.

Let op

  • at uses sh, not bash. Avoid bash-only syntax.
  • Output is sent by local mail; redirect it to a file if you need it.

Bestanden

/var/spool/at/
The queued jobs.
/etc/at.allow, /etc/at.deny
Who may use at.

Exitcodes

0 :: Done. 1 :: Error (bad time, not allowed, atd problem).