AT(1) Linux Programmer’s Manual AT(1) 名前 at, batch, atq, atrm - 後で実行するコマンドジョブをキューに入れたり、そ のようなジョブの閲覧・削除を行なう 書式 at [-V] [-q queue] [-f file] [-m] [-v] TIME at [-V] [-q queue] [-f file] [-m] [-v]-t time_arg at -c job [job...] at -l [-V] [-q queue] atq [-V] [-q queue] at -d [-V] [-q queue] job [job...] at -r [-V] [-q queue] job [job...] atrm [-V] [-q queue] job [job...] batch [-V] [-q queue] [-f file] [-mv] [TIME] 解説 at と batch は、標準入力や指定されたファイルからコマンドを読み取り、 後 で /bin/sh を使って実行する。 at 指定された時刻にコマンドを実行する。 atq このコマンドを起動したユーザーの、実行されていないジョブを表示 する。スーパーユーザーで起動すると、全てのユーザーのジョブを 表 示する。 atrm ジョブを削除する。 batch システムの負荷レベルが許可したときコマンドを実行する。すなわち 、負荷平均が 0.8 か、または atrun で指定された値を下回るとコ マ ンドを実行する。 at ではある程度複雑な TIME 指定ができる。これは POSIX.2 標準を拡張した ものである。ジョブを実行する時刻は HH:MM という形式で指定できる。 (すで にその時刻を過ぎているときは次の日に実行する。) また midnight (真夜中), noon (正午), teatime (午後4時のお茶の時間) とか、 AM , PM も指定できる 。 さ らに、コマンドの実行日を指定することもできる。日付の指定は month- name day ( year も追加できる) のようにする。また は MMDDYY, MM/DD/YY, DD.MM.YY なども可能である。日付の指定は、その日の時刻の後に指定しなけれ ばならない。また now + count time-units, と指定することでコマンドをどの く ら い 後に実行するか指定できる。時間の単位には minutes, hours, days, weeks が使える。さらにジョブを今日実行したい場合は today を、明日実行し たい場合は tomorrow を、それぞれ時刻の後に付ければ良い。 例 え ば 、 今日から 3 日後の午後 4 時にジョブを実行する場合 at 4pm + 3 days, とし、 7 月 31 日の午前 10 時にジョブを実行するときは at 10am Jul 31 とし、明日の午前 1 時に実行するときは at 1am tomorrow とする。 時間指定方法の厳密な定義は /usr/doc/at/timespec に書いてある。 at と batch は、ともに標準入力や -f オプションで指定されたファイルのコ マンドを実行する。作業ディレクトリ、環境 (環境変数 TERM, DISPLAY, _ を 除 く) 、 umask には、 at や batch が起動されたときのものが保存される。 su(1) したあとのシェルから起動された at (または batch ) コマンドでは 、 カ レントのユーザー ID が用いられる。コマンドを実行した結果、標準エラー 出力や標準出力が出ると、ユーザーはメールを受け取る。メールの配 送 に は /usr/bin/sendmail が用いられる。 at が su(1) したあとのシェルから起動さ れたときは、ログインシェルのオーナーがメールを受け取る。 スーパーユーザーは、どんな場合でも必ずこのコマンドを使うことができる 。 他のユーザーのパーミッションは /etc/at.allow と /etc/at.deny で指定する 。 /etc/at.allow があれば、そこに書かれたユーザーのみが at を使える。 /etc/at.allow がなければ /etc/at.deny をチェックし、そこに書かれて「 い ない」ユーザーすべてが at を使える。 も しどちらのファイルもなければ、スーパーユーザーのみ at を使うことがで きる。 空の /etc/at.deny があるときは、全てのユーザーがこれらのコマンドを使 う ことができる。この設定がデフォルトである。 オプション -V バージョン情報を標準エラー出力に表示する。 -q queue キュー指定をする。指定は英字1文字で行う。有効な文字は a から z と A から Z である。 a キューが at のデフォルトキューで、 b キ ューが batch のデフォルトキューである。後のほうの文字のキューほ ど、より nice レベルが大きくなる (実行の優先度が下がる)。特殊キ ュー "=" は現在実行されているジョブのために予約されている。 大文字のキューで予約されたジョブは、 batch で指定されたかのよう に扱われる。 atq でキューを指定すると、そのキューにたまっている 未実行ジョブだけを表示する。 -m ジョブが完了したとき、そのジョブがなにも出力しなくても、ユーザ ーに完了通知をメールする。 -f file 標準入力でなく、 file からジョブを読み取る。 -l atq と同じ働きをする。 -d, -r atrm と同じ働きをする。 atq で指定された場合には、キューの中 に 存 在している「終了したがまだ削除されていない」ジョブを表示する 。そのほかのコマンドで指定された場合は、そのジョブを実行する 時 刻を表示する。 時 刻は "1997-02-20 14:50" のような形式で表示される。ただし環境 変数 POSIXLY_CORRECT が指定されて い る 場 合 は "Thu Feb 20 14:50:00 1996" のようになる。 -v ジョブが実行される時間を表示する。 -t time_arg time_arg オプションで指定した時間にジョブを実行させるようにする 。 time_arg の書式は touch(1) の -t time オプションと同じでなけ ればならない。 -c コマンドラインで指定したジョブを標準出力に表示する。 ファイル /var/spool/atjobs /var/spool/atspool /proc/loadavg /var/run/utmp /etc/at.allow /etc/at.deny 関連項目 cron(1), nice(1), sh(1), umask(2), atd(8) バグ Linux で batch が正しく動作するためには、 /proc にマウントされた proc 形式のディレクトリが必要である。 もし /etc/utmp が壊れて使えなかったり、 at がジョブを実行するときにユー ザーがログインしてなかったりすると、環境変数 LOGNAME で指定されたユーザ ー ID にメールを送る。もしこの変数が定義されていなかったり、空だった り した場合、カレントのユーザー ID に送られる。 at と batch の現在の実装は、ユーザーが資源を取り合っているような状況下 では適当なものではない。このような場合は他のbatchシステム、たとえば nqs などを考えるべきだろう。 著者 at はほぼ Thomas Koenig, ig25@rz.uni-karlsruhe.de によって書かれた。 local Nov 1996 AT(1)
AT(1) Linux Programmer’s Manual AT(1) NAME at, batch, atq, atrm - queue, examine or delete jobs for later execu- tion SYNOPSIS at [-V] [-q queue] [-f file] [-mMlbv] TIME at [-V] [-q queue] [-f file] [-mMlbv] -t time_arg at -c job [job...] at [ -rd ] job [job...] atq [-V] [-q queue] atrm [-V] job [job...] batch DESCRIPTION at and batch read commands from standard input or a specified file which are to be executed at a later time. at executes commands at a specified time. atq lists the user’s pending jobs, unless the user is the supe- ruser; in that case, everybody’s jobs are listed. The format of the output lines (one for each job) is: Job number, date, hour, queue, and username. atrm deletes jobs, identified by their job number. batch executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified in the invocation of atd. At allows fairly complex time specifications, extending the POSIX.2 standard. It accepts times of the form HH:MM to run a job at a spe- cific time of day. (If that time is already past, the next day is assumed.) You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDDYY or MM/DD/YY or DD.MM.YY or YYYY-MM-DD. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow. For example, to run a job at 4pm three days from now, you would do at 4pm + 3 days, to run a job at 10:00am on July 31, you would do at 10am Jul 31 and to run a job at 1am tomorrow, you would do at 1am tomorrow. The exact definition of the time specification can be found in /usr/share/doc/at-3.1.10/timespec. For both at and batch, commands are read from standard input or the file specified with the -f option and executed. The working directory, the environment (except for the variables TERM, DISPLAY and _) and the umask are retained from the time of invocation. An at - or batch - command invoked from a su(1) shell will retain the current userid. The user will be mailed standard error and standard output from his com- mands, if any. Mail will be sent using the command /usr/sbin/sendmail. If at is executed from a su(1) shell, the owner of the login shell will receive the mail. The superuser may use these commands in any case. For other users, permission to use at is determined by the files /etc/at.allow and /etc/at.deny. If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at. If /etc/at.allow does not exist, /etc/at.deny is checked, every user- name not mentioned in it is then allowed to use at. If neither exists, only the superuser is allowed use of at. An empty /etc/at.deny means that every user is allowed use these com- mands, this is the default configuration. OPTIONS -V prints the version number to standard error. -q queue uses the specified queue. A queue designation consists of a single letter; valid queue designations range from a to z. and A to Z. The a queue is the default for at and the b queue for batch. Queues with higher letters run with increased niceness. The special queue "=" is reserved for jobs which are currently running. If a job is submitted to a queue designated with an uppercase letter, the job is treated as if it were submitted to batch at the time of the job. Once the time is reached, the batch processing rules with respect to load average apply. If atq is given a specific queue, it will only show jobs pending in that queue. -m Send mail to the user when the job has completed even if there was no output. -M Never send mail to the user. -f file Reads the job from file rather than standard input. -l Is an alias for atq. -r Is an alias for atrm. -d Is an alias for atrm. -v Shows the time the job will be executed before reading the job. Times displayed will be in the format "Thu Feb 20 14:50:00 1997". -c cats the jobs listed on the command line to standard out- put. -t time_arg Submit the job to be run at the time specified by the time_arg option argument, which must have the same format as specified for the touch(1) utility’s -t time option argument ([[CC]YY]MMDDhhmm). ENVIRONMENT SHELL The value of the SHELL environment variable at the time of at invocation will determine which shell is used to execute the at job commands. If SHELL is unset when at is invoked, the user’s login shell will be used; other- wise, if SHELL is set when at is invoked, it must contain the path of a shell interpreter executable that will be used to run the commands at the specified time. at will record the values of environment variables present at time of at invocation. When the commands are run at the speci- fied time, at will restore these variables to their recorded values . These variables are excluded from this processing and are never set by at when the commands are run : TERM, DISPLAY, SHELLOPTS, _, PPID, BASH_VERSINFO, EUID, UID, GROUPS. If the user submitting the at job is not the super-user, vari- ables that alter the behaviour of the loader ld.so(8), such as LD_LIBRARY_PATH , cannot be recorded and restored by at . FILES /var/spool/at /var/spool/at/spool /proc/loadavg /var/run/utmp /etc/at.allow /etc/at.deny SEE ALSO cron(1), nice(1), sh(1), umask(2), atd(8). BUGS The correct operation of batch for Linux depends on the presence of a proc- type directory mounted on /proc. If the file /var/run/utmp is not available or corrupted, or if the user is not logged on at the time at is invoked, the mail is sent to the userid found in the environment variable LOGNAME. If that is undefined or empty, the current userid is assumed. At and batch as presently implemented are not suitable when users are competing for resources. If this is the case for your site, you might want to consider another batch system, such as nqs. AUTHOR At was mostly written by Thomas Koenig, ig25@rz.uni-karl- sruhe.de. local Nov 1996 AT(1)
Copyright(C) linux-cmd.com All Rights Reserved. Author Takayuki Yukawa