AI Crawler · Collection Records

Bot summary · Last 24 hours

at — one-time scheduled execution

A command for scheduling a job to run only once at a specific time. Useful for maintenance and deployment windows.
Markdown source·Anything to add or correct?

💬 "at command"

The at command is a scheduled job that runs only once. Unlike cron, it does not repeat.

Use it to schedule restarts or maintenance during low-traffic times.

  • Concept: Runs a command once at a specified time.
  • Time specification: Use the format '02:30' or 'now + 10 minutes'.
  • List: View scheduled jobs with atq.
  • Cancel: Cancel a scheduled job with atrm.

Commonly used options

OptionDescription
at <time>Accepts a job to run at the specified time in input mode
atqView scheduled job list
atrm <number>Cancel a scheduled job
-f <file>Schedule a script file

3 essential command combinations

  • echo '/opt/app/bin/restart.sh' | at 03:30 — Schedule a restart at 03:30 in the early morning
  • atq — View scheduled job list
  • atrm 7 — Cancel scheduled job number 7

💬 "Show me an example that also considers preventing the same problem from recurring"

Common situations on production servers are organized in order.

Step 1 · Schedule

Specify the time and command.


echo '/opt/app/bin/restart.sh > /tmp/restart.log 2>&1' | at 03:30

Step 2 · Verify

View the scheduled job list.


atq

Step 3 · Cancel/Validate

Cancel if necessary and check the result log.


atrm 7 ; cat /tmp/restart.log

In practice, it is used like this

1. Restart during low-traffic time

Situation — You need to restart the service during a weekly maintenance window.


echo 'systemctl restart myapp' | at 04:00

Result — A one-time restart runs at 04:00.

Point — Include a health check after restart in the same script for automatic verification.

2. Schedule a temporary job

Situation — You want a one-time cleanup 30 minutes later.


echo '/opt/app/bin/cleanup.sh' | at now + 30 minutes

Result — It runs once 30 minutes later.

Point — If the atd service is stopped, the job will not run, so check it.

Things to watch out for

  • If the atd service is stopped, scheduled jobs will not run.
  • Without output redirection, you cannot see the results.
  • You need to verify whether jobs persist across reboots (in some environments, atd alone is not enough).

Actual execution screen

This is the result after scheduling a restart job at 04:00 in the early morning and checking the list.

!at command execution result: one-time scheduled job and list

Production server


Source (HTML): https://games.aidebatehub.com/programs/linux/automation/at.html This file is an auto-generated Markdown twin of the DevHub document.

Visitor Comments

Loading…
💬 Comments: 0 · Author type: human | Built: 2026-10-30T20:30:58+09:00