Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ crontab(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cron

sh, Rsh



CRONTAB(1,C)                AIX Commands Reference                 CRONTAB(1,C)



-------------------------------------------------------------------------------
crontab



PURPOSE

Submits a schedule of commands to the cron command.

SYNTAX


           +------------+
crontab ---| +- file -+ |---|
           +-| one of |-+
             | +----+ |
             +-| -l |-+
               | -r |
               +----+


DESCRIPTION

The crontab command copies the specified file, or standard input if you do not
specify file, into a directory that holds all users' crontab files.  The cron
command runs commands according to the instructions in these crontab files.  It
then mails you the output from standard output and standard error for these
commands, unless you redirect standard output or standard error.  When crontab
replaces a crontab file, the previous contents of the file are erased.

You may use the crontab command if your logname appears in the file
/usr/adm/cron/cron.allow.  If that file does not exist, the crontab command
checks the file /usr/adm/cron/cron.deny to determine if you should be denied
use of the command.  If neither file exists, you can submit a job only if you
are operating with superuser authority.  The allow/deny files contain one user
name per line.

Notes:

  1. If your login ID is associated with more than one login name, the crontab
    command uses the first login name that appears in the /etc/passwd file,
    regardless of which login name you might actually be using.

  2. If the cron.allow command exists, the superuser's logname must appear
    there for the superuser to be able to use the command.

  3. Each user has a distinct crontab file on each site in a cluster.  The
    crontab command only sets, lists, or removes the user's local crontab file.
    To access your crontab files on other cluster sites, use the on command to
    specify another cluster site.





Processed November 8, 1990       CRONTAB(1,C)                                 1





CRONTAB(1,C)                AIX Commands Reference                 CRONTAB(1,C)



  4. The crontab file for the root user is used to run system management
    commands at regular intervals.  This crontab files runs the three shell
    scripts /usr/adm/daily, /usr/adm/weekly, and usr/adm/monthly.  These
    scripts can be customized for your system if you have superuser authority.

Each crontab file entry consists of a line with six fields, separated by spaces
and tabs, that contain, respectively:

  1. The minute (0-59)
  2. The hour (0-23)
  3. The day of the month (1-31)
  4. The month of the year (1-12)
  5. The day of the week (0-6 for Sunday-Saturday)
  6. The shell command.

Each of these fields can contain:

  o A number in the specified range
  o Two numbers separated by a minus to indicate an inclusive range
  o A list of numbers separated by commas, which selects all numbers in the
    list
  o An asterisk, meaning all legal values.

The specification of days may be made in two fields (day of the month and day
of the week).  If you specify both as a list of elements, both are adhered to.
For example, the following entry:

  0 0 1,15 * 1 command

runs command on the first and fifteenth days of each month, as well as every
Monday.  To specify days in only one field, the other field should contain an
"*" (asterisk).

The cron command runs the command named in the sixth field at the selected date
and time.  If you include a "%" (percent sign) in the sixth field, the cron
command treats everything that precedes it as the command invocation and makes
all that follows it available to standard input, unless you escape or quote the
percent sign ("\%" or ""%"").  Any additional % (percent sign) in the line are
treated as newline in the standard input stream.

Note:  The shell runs only the first line of the command field (up to a "%" or
       end of line).  All other lines are made available to the command as
       standard input.

The cron command invokes a subshell from your $HOME directory.  This means that
it does not run your .profile file.  If you schedule a command to run when you
are not logged in and you want to have commands in your .profile file run, you
must explicitly do so in the crontab file.  (For a more detailed discussion of
how sh can be invoked, see "sh, Rsh").

The cron command supplies a default environment for every shell, defining HOME,
LOGNAME, SHELL (="/bin/sh"), and PATH (=":/bin:/usr/bin").



Processed November 8, 1990       CRONTAB(1,C)                                 2





CRONTAB(1,C)                AIX Commands Reference                 CRONTAB(1,C)




FLAGS

-l          Lists your crontab file.

-r          Removes your crontab file from the crontab directory.

EXAMPLES

The following examples show valid crontab file entries.

  1. To write the time to the console every hour on the hour:

      0 * * * * echo The hour is `date`. >/dev/console

    This example uses command substitution.  For more information, see "Command
    Substitution."

  2. To run the calendar command at 6:30 a.m. every day:

      30 6 * * * /usr/bin/calendar -

  3. To define text for the standard input to a command:


0 16 10-31 12 5 /etc/wall%HAPPY HOLIDAYS!%Remember to turn in your time card.

    This command writes a message to all users logged in at 4:00 p.m. every day
    between December 10 and 31.

    The text following the "%" (percent sign) defines the standard input to the
    wall command as:

      HAPPY HOLIDAYS!
      Remember to turn in your time card.

FILES

/usr/adm/cron               Main cron command directory.
/usr/spool/cron/crontabs    Spool area.
/usr/adm/cron/cron.allow    List of allowed users.
/usr/adm/cron/cron.deny     List of denied users.

RELATED INFORMATION

See the following commands:  "cron" and "sh, Rsh."









Processed November 8, 1990       CRONTAB(1,C)                                 3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026