*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> batch (1)              


 at(1)                                                                 at(1)

 NAME    [Toc]    [Back]
      at, batch - execute batched commands immediately or at a later time

 SYNOPSIS    [Toc]    [Back]
    Enter commands from standard input to run at a specified time:
      at [-m] [-q queue] -t spectime

      at [-m] [-q queue] time [date]
           [next timeunit | +count timeunit]

    Enter commands from a file to run at a specified time:
      at -f job-file [-m] [-q queue] -t spectime

      at -f job-file [-m] [-q queue] time [date]
           [next timeunit | +count timeunit]

    List scheduled jobs:
      at -d job-id ...

      at -l [job-id ...]

      at -l -q queue

    Cancel (remove) a scheduled job:
      at -r job-id ...

    Enter commands from standard input to run as a batch process:

    Enter commands from a file to run as a batch process:
      batch < job-file

 DESCRIPTION    [Toc]    [Back]
      The 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:

 Hewlett-Packard Company            - 1 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

        +  From the keyboard on separate lines immediately after the at or
           batch command line, followed by the currently defined eof (endof-file)
 character to end the input.  The default eof is Ctrl-D.
           It can be redefined in your environment (see stty(1)).

        +  With the -f option of the at command to read input from a script

        +  From output piped from a preceding command.

    Options and Arguments    [Toc]    [Back]
      at recognizes the following options and arguments.

           commands            One or more HP-UX commands that can be
                               executed as a shell script by at or batch.

           eof                 End-of-file character.  The default is Ctrl-D
                               unless defined otherwise in your environment.

           job-file            The path name of an existing file.

           job-id              The job identifier reported by at or batch
                               when the job was originally scheduled.

           -d job-id ...       Displays the contents of the specified job.
                               An unprivileged user is restricted to display
                               information only on jobs that the user owns.
                               A user with the appropriate privileges is
                               able to display information about all jobs.

           -f job-file         Read in the commands contained in job-file
                               instead of using standard input.

           -l [job-id ...]     List the jobs specified.  If no job-ids are
                               given, all jobs are listed.

           -m                  Send mail to the invoking user after the job
                               has run, announcing its completion.  Unless
                               redirected elsewhere within the job, standard
                               output and standard error produced by the job
                               are automatically mailed to the user as well.

           -q queue            Submit the specified job to the queue
                               indicated (see queuedefs(4)).  Queues a, b,
                               and d through y can be used.  at uses queue a
                               by default.  batch always uses queue b.  All
                               queues except b require a time or a -t
                               specification.  at -qb is equivalent to
                               batch.  When used with the -l option, limit
                               the search to that particular queue.

 Hewlett-Packard Company            - 2 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

           -r job-id ...       Remove the jobs specified by each job-id.

           -t spectime         Define the absolute time to start the job.

                               spectime  A date and time in the format:

                                              [[CC]YY]MMDDhhmm [ . ss ]

                                         where the decimal digit pairs are
                                         as follows:

                                         CC   The first two digits of the
                                              year (19, 20).
                                         YY   The second two digits of the
                                              year (69-99, 00-68).  See
                                         MM   The month of the year (01-12).
                                         DD   The day of the month (01-31).
                                         hh   The hour of the day (00-23).
                                         mm   The minute of the hour
                                         ss   The second of the minute

                                         If both CC and YY are omitted, the
                                         default is the current year.

                                         If CC is omitted and YY is in the
                                         range 69-99, CC defaults to 19.
                                         Otherwise, CC defaults to 20.

                                         The range for ss provides for two
                                         leap seconds.  If ss is 60 or 61,
                                         and the resulting time, as affected
                                         by the TZ environment variable,
                                         does not refer to a leap second,
                                         the time is set to the whole minute
                                         following mm.

                                         If ss is omitted, it defaults to

           time [date]         Define the base time for starting the job.

                               time      A time specified as one, two, or
                                         four digits.  One- and two-digit
                                         numbers represent hours; four
                                         digits represent hours and minutes.

                                         Alternately, time can be specified
                                         as two numbers separated by a colon

 Hewlett-Packard Company            - 3 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

                                         (:), a single quote ('), the letter
                                         h (h), a period (.), or a comma
                                         (,).  Spaces may be present between
                                         the separator and digits
                                         representing minutes.  If defined
                                         in langinfo(5), special time unit
                                         characters can be used.

                                         am or pm can be appended to
                                         indicate morning or afternoon.
                                         Otherwise, a 24-hour clock is
                                         understood.  For example, 0815,
                                         8:15, 8'15, 8h15, 8.15, and 8,15
                                         are read as 15 minutes after eight
                                         in the morning.  The suffixes zulu
                                         and utc can be used to specify
                                         Coordinated Universal Time (UTC),
                                         equivalent to Greenwich Mean Time

                                         The special names midnight, noon,
                                         and now are also recognized.

                               date      A day of the week (fully spelled
                                         out or abbreviated) or a date
                                         consisting of a day, a month, and
                                         optionally a year.  The day and
                                         year fields must be numeric, and
                                         the month can be either fully
                                         spelled out, abbreviated, or
                                         numeric.  The fields in the date
                                         string are separated by punctuation
                                         marks such as slash (/), hyphen (-
                                         ), period (.), and comma (,).  If
                                         defined in langinfo(5), special
                                         date unit characters can be
                                         present.  A field having a value
                                         greater than 31 is treated as the
                                         year field and the remaining two
                                         fields in the date string are
                                         treated as month and day fields.
                                         Otherwise, if a given date is
                                         ambiguous (such as 2/5 or 2/5/10),
                                         the D_T_FMT string (if defined in
                                         langinfo(5)) is used to resolve the

                                         Two special days, today and
                                         tomorrow, are also recognized.  If
                                         no date is given, today is assumed
                                         if the given time is greater than

 Hewlett-Packard Company            - 4 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

                                         the current time; 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.
                                         Two-digit years in the range 69 to
                                         99 are expanded to 1969 to 1999; in
                                         the range 00 to 68, to 2000 to

           next timeunit |  + count timeunit

                               Delay the execution date and time by a
                               specific number of time units after the base
                               time specified by time [date].

                               count     A decimal number.  next is
                                         equivalent to +1.

                               timeunit  A time unit, one of the following:
                                         minutes, hours, days, weeks,
                                         months, or years, or their singular

    How Jobs Are Processed    [Toc]    [Back]
      When 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.

 Hewlett-Packard Company            - 5 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

      The second part consists of the commands that you entered.

      When cron dispatches the job, it starts a POSIX shell to execute the

      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.

    Environment Variables
      LC_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)).

    International Code Set Support    [Toc]    [Back]
      Single- and multi-byte character code sets are supported.

    Notes    [Toc]    [Back]
      The 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

 Hewlett-Packard Company            - 6 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

      command exist with the message queue full.  If the BatchConfig product
      is installed, 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.

 RETURN VALUE    [Toc]    [Back]
      The exit code is set to one of the following:

            0   Successful completion
            1   Failure

 DIAGNOSTICS    [Toc]    [Back]
      at produces self-explanatory messages for syntax errors and out-ofrange

      warning: commands will be executed using /usr/bin/sh

           If your login shell is not the POSIX shell (/usr/bin/sh), at and
           batch produce a warning message as a reminder that at and batch
           jobs are executed using /usr/bin/sh.

 EXAMPLES    [Toc]    [Back]
      The 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

           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.

 Hewlett-Packard Company            - 7 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

           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

           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

           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

 WARNINGS    [Toc]    [Back]
      If the date argument begins with a number and the time argument is
      also numeric without a suffix, the time argument should be a fourdigit
 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

 Hewlett-Packard Company            - 8 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

      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

      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.

 DEPENDENCIES    [Toc]    [Back]
    HP Process Resource Manager
      If 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

 AUTHOR    [Toc]    [Back]
      at was developed by AT&T and HP.

 FILES    [Toc]    [Back]
      /usr/bin/sh                        POSIX shell
      /var/adm/cron                      Main cron directory
      /var/adm/cron/.proto               This file contains a set of shell
                                         commands which are added to the at
                                         job file to make the environment
                                         for the at job same as the current
                                         environment. See proto(4).
      /usr/lib/cron/at.allow             List of allowed users
      /usr/lib/cron/at.deny              List of denied users
      /var/adm/cron/queuedefs            Scheduling information
      /var/spool/cron/atjobs             Spool area

 SEE ALSO    [Toc]    [Back]
      crontab(1), kill(1), mail(1), nice(1), ps(1), sh(1), stty(1),
      cron(1M), proto(4), queuedefs(4).

      HP Process Resource Manager: prmconfig(1), prmconf(4) in HP Process
      Resource Manager User's Guide.

      at: SVID2, SVID3, XPG2, XPG3, XPG4

 Hewlett-Packard Company            - 9 -      HP-UX 11i Version 2: Sep 2004

 at(1)                                                                 at(1)

      batch: SVID2, SVID3, XPG2, XPG3, XPG4

 Hewlett-Packard Company           - 10 -      HP-UX 11i Version 2: Sep 2004
[ Back ]
 Similar pages
Name OS Title
at IRIX execute commands at a later time
VkCmdManager IRIX execute commands
cron FreeBSD daemon to execute scheduled commands (Vixie Cron)
cron Linux daemon to execute scheduled commands (Vixie Cron)
hosts.equiv Tru64 A file containing the names of remote systems and users that can execute commands on the local syste...
alarm IRIX execute a subroutine after a specified time
timeout OpenBSD execute a function after a specified period of time
timeout_add OpenBSD execute a function after a specified period of time
untimeout NetBSD execute a function after a specified length of time
after IRIX Execute a command after a time delay
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service