Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ crontab(1) — RISC iX 1.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

at(1)

sh(1)

cron(8)

CRONTAB(1)  —  UNIX Programmer’s Manual

NAME

crontab − create, list or remove user crontab file

SYNOPSIS

crontab [ file ]
crontab −l
crontab −r

DESCRIPTION

This utility copies the specified file, or standard input if no file is specified, into the directory /var/spool/cron/crontabs.  The name of the file created in the crontabs directory will be the same as the user’s username. 

If called with the -l option, the user’s crontab file is listed. 
If called with the -r option, the user’s crontab file is removed.

Users are allowed to use crontab if their names appear in the file /var/spool/cron/cron.allow.  If that file does not exist, the file /var/spool/cron/cron.deny is checked to see if the user is to be denied access to crontab.  If neither file exists, only root has access. If only cron.deny exists, and it is empty, all users have access.  The cron.allow and cron.deny files consist of one user name per line. 

A crontab file consists of a sequence of non-blank lines.  Each line has six fields, each field being separated by spaces or tabs.  The first five fields are used to specify a time and day when the sixth field (a string) is to be executed by the shell. The details are as follows:

Field 1 minute [0,59]
Field 2 hour [0,23]
Field 3 day of month [1,31]
Field 4 month of year [1,12]
Field 5 day of week [0,6] (where 0 = Sunday)

Each of these numerical-type fields can be specified as follows:

Field-contents Meaning
∗ all legal values
number-number range of values
number{,number{-number}} list of values

It will be noticed that there is a degree of overlap in the way in which days can be specified, i.e. the command (sixth field) can be made to run on a certain day of the week (every week), or on a particular day of the month or a combination of the two.  When specifying days by only one field, the other field should be set to ∗. 

The sixth field specifies the command to be executed by the shell.  A % character in this field (unless escaped by \) is translated to a newline character.  Only the first line (up to a % or end of line) of the command field is executed by the shell. The other lines are passed to the command as standard input. 

A default environment is provided for the user when their commands are executed. This is as follows:

HOME=(users home directory)
LOGNAME=(username)
PATH=:/usr/5bin:/usr/bin:/usr/ucb

The shell used to execute the commands is /usr/bin/sh the commands being run from the user’s home directory. 

Lines in a crontab file which begin with a ‘#’ are ignored. 
If standard output and standard error are not redirected, any generated output or errors will be mailed to the user.

EXAMPLE

$ crontab
# Run myscript at 4:30 am each Saturday
# myscipt is an executable file in my home directory,
# it will be executed by /sbin/sh and
# the files cron-out and cron-err will be created
# in my home directory.
30 2 ∗ ∗ 6 /sbin/sh myscript > cron-out 2> cron-err
^D

APPLICATION USAGE

A new crontab file for a user overwrites an existing one.  Typing:
$ crontab
^D
will create a new, empty crontab file!

FILES

/var/spool/cron/crontabswhere user crontab files are stored
/var/spool/cron/cron.allowlist of allowed users
/var/spool/cron/cron.denylist of denied users

SEE ALSO

at(1), sh(1), cron(8)

DIAGNOSTICS

Complains about various syntax errors (including blank lines). 

7th Edition  —  Revision 1.2 of 17/09/90

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