United States-English |
|
|
HP-UX Reference > Aat(1)HP-UX 11i Version 3: February 2007 |
|
NAMEat, batch — execute batched commands immediately or at a later time SYNOPSISEnter commands from standard input to run at a specified time:at [-m] [-q queue] -t spectime commands eof at [-m] [-q queue] time [date] [next timeunit | +count timeunit] commands eof DESCRIPTIONThe at and batch commands schedule jobs for execution by the cron daemon (see cron(1M)). at schedules a job for execution at a specified time. at can also list (-l) or remove (-r) existing scheduled at and batch jobs. batch schedules a job for execution immediately, or as soon as system load levels permit. You can enter commands into a job in one of the following ways:
Options and Argumentsat recognizes the following options and arguments.
How Jobs Are ProcessedWhen a job is accepted, at and batch print a message to standard error in the form: job job-id at execution-date where job-id is the job identifier in the form jobnumber.queue, such as 756284400.a, and execution-date is the date and time when the job will be released for execution. If your login shell is not the POSIX shell (/usr/bin/sh), the commands also print a warning message: warning: commands will be executed using /usr/bin/sh at jobs default to queue a. batch jobs always go in queue b. See the -q option. An at or batch job consists of a two-part script stored in /var/spool/cron/atjobs that can be executed by the POSIX shell. The first part sets up the environment to match the environment when the at or batch command was issued. This includes the current shell environment variables, current directory, umask, and ulimit (see ulimit(2), umask(1), and proto(4)). Open file descriptors, traps, and priority are lost. The second part consists of the commands that you entered. When cron dispatches the job, it starts a POSIX shell to execute the script. The number of jobs executing from a queue at any time is controlled by parameters in the file /var/adm/cron/queuedefs (see queuedefs(4)). Standard output and standard error from the job are mailed to the user unless they are redirected elsewhere within the job. Scheduled jobs are immune to the SIGHUP hangup signal, and remain scheduled if the user logs off. Users are permitted to use the at and batch commands if their user names appear in the file /usr/lib/cron/at.allow. If that file does not exist, users can use at and batch if their names do not appear in the file /usr/lib/cron/at.deny. If neither file exists, only superuser is allowed to submit jobs. If only at.deny exists but is empty, all users can use at and batch. The allow/deny files consist of one user name per line. All users can list and remove their own jobs. Users with appropriate privileges can list and remove jobs other than their own. NotesThe batch command requests a unique job-id for each batch job it schedules. The maximum number of tries to request a unique job-id is restricted to 100. If not successful after 100 tries, the batch command exits with the message queue full. You can configure this number by setting the variable BATCH_MAXTRYS=value in the /etc/default/cron file. The value of BATCH_MAXTRYS can be any positive number or the string INFINITE (the default value). If the value is set to INFINITE, batch requests a unique job-id until it successfully receives one. The at command can schedule only one job per queue for a given time. If a job is already scheduled for a given time, the at command schedules the new job for the next second. You can remove this limitation by setting the variable MULTI_JOB_SUPPORT to 1 in the /etc/default/cron file. If MULTI_JOB_SUPPORT is set to 1, then at supports scheduling multiple jobs for the same time and creates the job-id in the form jobnumber.queue.index , where index is the total number of jobs scheduled for the given time. You can disable this feature by setting the variable MULTI_JOB_SUPPORT to 0. Security RestrictionsIf the compartmentalization feature is enabled, cron and at invoke the jobs from the compartment that the jobs were created from. Note that at creates the job files in /var/spool/cron/atjobs. Hence, if the at command is invoked from a compartment which has no write access to this directory and which disallows the COMMALLOWED privilege, at fails to schedule the jobs. See compartments(5) and privileges(5) for more information. EXTERNAL INFLUENCESEnvironment VariablesLC_TIME determines the format and contents of date and time strings. LC_MESSAGES determines the language in which messages are displayed. LC_MESSAGES also determines the language in which the words days, hours, midnight, minutes, months, next, noon, now, today, tomorrow, weeks, years, and their singular forms can also be specified. IF LC_TIME or LC_MESSAGES is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable. If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG. If any internationalization variable contains an invalid setting, all internationalization variables default to "C" (see environ(5)). DIAGNOSTICSat produces self-explanatory messages for syntax errors and out-of-range times. warning: commands will be executed using /usr/bin/sh
EXAMPLESThe following commands show three different ways to run a POSIX shell script file named delayed-job five minutes from now: at -f delayed-job now + 5 minutes cat delayed-job | at now + 5 minutes at now + 5 minutes <delayed-job Run a typical HP-UX command (nroff in this case) when system load levels permit, and redirect standard output and standard error to files: batch nroff source-file >output-file 2>error-file eof (the default is Ctrl-D) Run a job contained in future in the home directory at 12:20 a.m. on December 27, 2013: at -f $HOME/future -t201312271220.00 Redirect standard error to a pipe (useful in a shell procedure). Note that the sequence of the output redirection specifications is significant. Standard error is redirected to where standard output is going; standard output is redirected to a file; the original "standard output" (which now consists of the former standard error) is piped to the mail program. batch <<!! (sets eof temporarily to !!) nroff input-file 2>&1 1> output-file | mail loginid !! Run a job contained in jobfile in the home directory at 5:00 a.m. next Tuesday: at -f $HOME/jobfile 5am tuesday next week Run the same job at 5:00 a.m. one week from next Tuesday (i.e., 2 Tuesdays in advance): at -f $HOME/jobfile 5am tuesday + 2 weeks Add a command to the file named weekly-run in directory jobs in the home directory so that it automatically reschedules itself every time it runs. This example reschedules itself every Thursday at 1900 (7:00 p.m.): echo "sh $HOME/jobs/weekly-run" | at 1900 thursday next week The following commands show several forms recognized by at and include native language usage: at 0815 Jan 24 at 8:15 Jan 24 at 9:30am tomorrow at now + 1 day at -f job 5 pm Friday at 17:40 Tor. # in Danish at 17h46 demain # in French at 5:30 26. Feb. 1988 # in German at 12:00 26-02 # in Finnish WARNINGSIf the date argument begins with a number and the time argument is also numeric without a suffix, the time argument should be a four-digit number that can be correctly interpreted as hours and minutes. If you use both next and +count within a single at command, the first operator is accepted and the trailing operator is silently ignored. If you use both -t and time ... in the same command, the first specified is accepted and the second is silently ignored. If the FIFO used to communicate with cron fills up, at is suspended until cron has read sufficient messages from the FIFO to make room for the message at is trying to write. This condition can occur if at is writing messages faster than cron can process them or if cron is not executing. Scheduled processes are run in the background. Any script file that calls itself will cause the user or the system to run out of available processes. If the execution-time request for a job duplicates the execution time of a currently scheduled job, the new job time is set to the next available second. at will not schedule jobs whose start time precedes the current Epoch (00:00:00 January 1, 1970 UTC). at will not schedule jobs beyond the year 2037. DEPENDENCIESHP Process Resource ManagerIf the optional HP Process Resource Management (PRM) software is installed and configured, jobs are launched in the initial process resource group of the user that scheduled the job. The user's initial group is determined at the time the job is started, not when the job is scheduled. If the user's initial group is not defined, the job runs in the user default group (PRMID=1). See prmconfig(1) for a description of how to configure HP PRM, and prmconf(4) for a description of how the user's initial process resource group is determined. FILES
SEE ALSOcrontab(1), kill(1), mail(1), nice(1), ps(1), sh(1), stty(1), cron(1M), proto(4), queuedefs(4), compartments(5), privileges(5). HP Process Resource Manager: prmconfig(1), prmconf(4) in HP Process Resource Manager User's Guide. |
Printable version | ||
|