at

プロセスとシステム

書き方

at <time> (then type the command, Ctrl+D to finish)

指定した時刻に一度だけコマンドを実行します。atd デーモンが動いている必要があり(最近の配布物では入ってさえいないことも)、出力は画面ではなくメールに届きます。

よく使うオプション

オプション意味
at 15:00 / at 3pm tomorrowAbsolute times, in many spellings.
at now + 10 minutesRelative times: minutes, hours, days, weeks.
-f <file>Run a script file instead of typing the command.
atqList the jobs you have queued (same as at -l).
atrm <n>Delete queued job number n (same as at -r).

echo "systemctl restart nginx" | sudo at now + 5 minutes

One restart, five minutes from now.

at -f deploy.sh 02:00

Run a script once at 2am.

atq

Check what is still queued.

何が動いていて何が資源を食っているかを見ます。止める前に何なのかを確かめるのが順番です。

読み方

  • 角括弧 [ ] は省いてよい部分です。
  • 三点 … は複数並べられるという意味です。
  • オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。

よくある質問

Q. at は何をしますか。

指定した時刻に一度だけコマンドを実行します。atd デーモンが動いている必要があり(最近の配布物では入ってさえいないことも)、出力は画面ではなくメールに届きます。

Q. どう打ちますか。

at <time> (then type the command, Ctrl+D to finish) — 角括弧は省いてよい部分です。

Q. よく使うオプションはいくつですか。

ここにまとめたのは5個です。全部は man at にあります。このコマンドはプロセスとシステムの仲間です。

関連するコマンド

man ページ: man at