at
プロセスとシステム
書き方
at <time> (then type the command, Ctrl+D to finish)指定した時刻に一度だけコマンドを実行します。atd デーモンが動いている必要があり(最近の配布物では入ってさえいないことも)、出力は画面ではなくメールに届きます。
よく使うオプション
| オプション | 意味 |
|---|---|
| at 15:00 / at 3pm tomorrow | Absolute times, in many spellings. |
| at now + 10 minutes | Relative times: minutes, hours, days, weeks. |
| -f <file> | Run a script file instead of typing the command. |
| atq | List 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 minutesOne restart, five minutes from now.
at -f deploy.sh 02:00Run a script once at 2am.
atqCheck 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