at, batch - execute commands at a later time
/usr/bin/at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] -t time
/usr/bin/at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] timespec...
/usr/bin/at -l [-p project] [-q queuename] [at_job_id. ..]
/usr/bin/at -r at_job_id. ..
/usr/bin/batch [-p project]
/usr/xpg4/bin/at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] -t time
/usr/xpg4/bin/at [-c | -k | -s] [-m] [-f file] [-p project] [-q queuename] timespec...
/usr/xpg4/bin/at -l [-p project] [-q queuename] [at_job_id. ..]
/usr/xpg4/bin/at -r at_job_id. ..
/usr/xpg4/bin/batch [-p project]
The at utility reads commands from standard input and groups them together as an at-job, to be executed at a later time.
The at-job is executed in a separate invocation of the shell, running in a separate process group with no controlling terminal, except that the environment variables, current working directory, file creation mask (see umask(1)), and system resource limits (for sh and ksh only, see ulimit(1)) in effect when the at utility is executed is retained and used when the at-job is executed.
When the at-job is submitted, the at_job_id and scheduled time are written to standard error. The at_job_id is an identifier that is a string consisting solely of alphanumeric characters and the period character. The at_job_id is assigned by the system when the job is scheduled such that it uniquely identifies a particular job.
User notification and the processing of the job's standard output and standard error are described under the -m option.
Users are permitted to use at and batch (see below) if their name appears in the file /usr/lib/cron/at.allow. If that file does not exist, the file /usr/lib/cron/at.deny is checked to determine if the user should be denied access to at. If neither file exists, only a user with the solaris.jobs.user authorization is allowed to submit a job. If only at.deny exists and is empty, global usage is permitted. The at.allow and at.deny files consist of one user name per line.
cron and at jobs are not be executed if the user's account is locked. Only accounts which are not locked as defined in shadow(4) will have their job or process executed.
The batch utility reads commands to be executed at a later time.
Commands of the forms:
/usr/bin/batch [-p project] /usr/xpg4/bin/batch [-p project]
are respectively equivalent to:
/usr/bin/at -q b [-p project] now /usr/xpg4/bin/at -q b -m [-p project] now
where queue b is a special at queue, specifically for batch jobs. Batch jobs are submitted to the batch queue for immediate execution. Execution of submitted jobs can be delayed by limits on the number of jobs allowed to run concurrently. See queuedefs(4).
If the -c, -k, or -s options are not specified, the SHELL environment variable by default determines which shell to use.
For /usr/xpg4/bin/at and /usr/xpg4/bin/batch, if SHELL is unset or NULL, /usr/xpg4/bin/sh is used.
For usr/bin/at and /usr/bin/batch, if SHELL is unset or NULL, /bin/sh is used.
The following options are supported:
-c
-k
-s
-f file
-l
-m
If -m is not used, the job's standard output and standard error is provided to the user by means of mail, unless they are redirected elsewhere; if there is no such output to provide, the user is not notified of the job's completion.
-p project
-q queuename
-r at_job_id
-t time
The following operands are supported:
at_job_id
timespec
In the "C" locale, the following describes the three parts of the time specification string. All of the values from the LC_TIME categories in the "C" locale are recognized in a case-insensitive manner.
time
midnight
noon
now
date
today
tomorrow
If no date is given, today is assumed if the given time is greater than the current time, and tomorrow is assumed if it is less. If the given month is less than the current month (and no year is given), next year is assumed.
increment
at 2pm + 1 week at 2pm next week
The format of the at command line shown here is guaranteed only for the "C" locale. Other locales are not supported for midnight, noon, now, mon, abmon, day, abday, today, tomorrow, minutes, hours, days, weeks, months, years, and next.
Since the commands run in a separate shell invocation, running in a separate process group with no controlling terminal, open file descriptors, traps and priority inherited from the invoking environment are lost.
Example 1 Typical Sequence at a Terminal
This sequence can be used at a terminal:
$ at -m 0730 tomorrow sort < file >outfile <EOT>
Example 2 Redirecting Output
This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant):
$ at now + 1 hour <<! diff file1 file2 2>&1 >outfile | mailx mygroup
Example 3 Self-rescheduling a Job
To have a job reschedule itself, at can be invoked from within the at-job. For example, this "daily-processing" script named my.daily runs every day (although crontab is a more appropriate vehicle for such work):
# my.daily runs every day at now tomorrow < my.daily daily-processing
Example 4 Various Time and Operand Presentations
The spacing of the three portions of the "C" locale timespec is quite flexible as long as there are no ambiguities. Examples of various times and operand presentations include:
at 0815am Jan 24 at 8 :15amjan24 at now "+ 1day" at 5 pm FRIday at '17 utc+ 30minutes'
Example 5 Typical Sequence at a Terminal
This sequence can be used at a terminal:
$ batch sort <file >outfile <EOT>
Example 6 Redirecting Output
This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant):
$ batch <<! diff file1 file2 2>&1 >outfile | mailx mygroup !
See environ(5) for descriptions of the following environment variables that affect the execution of at and batch: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, NLSPATH, and LC_TIME.
DATEMSK
SHELL
TZ
The following exit values are returned:
0
>0
/usr/lib/cron/at.allow
/usr/lib/cron/at.deny
See attributes(5) for descriptions of the following attributes:
|
|
|
|
auths(1), crontab(1), csh(1), date(1), ksh(1), sh(1), touch(1), ulimit(1), umask(1), cron(1M), getdate(3C), auth_attr(4), shadow(4), queuedefs(4), attributes(5), environ(5), standards(5)
Regardless of queue used, cron(1M) has a limit of 100 jobs in execution at any time.
There can be delays in cron at job execution. In some cases, these delays can compound to the point that cron job processing appears to be hung. All jobs are executed eventually. When the delays are excessive, the only workaround is to kill and restart cron.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |