COHERENT manpages

This page displays the COHERENT manpage for crontab [Copy a command file into the crontab directory].

List of available manpages
Index


crontab -- Command

Copy a command file into the crontab directory
/usr/bin/crontab [-l] [-r] [-f filename] [-m[ed]] [-uuser]

The   command    crontab   copies    a   command   file    into   directory
/usr/spool/cron/crontabs. This  directory holds  the command files  for all
users.  This mechanism  permits each user to have her  own file of commands
to be executed  periodically.  If the file name is  `-', then crontab reads
the standard input.

crontab recognizes the following options.

-f filename
     Replace your crontab file with filename.

-l   List your crontab file.

-m[ed]
     Enable/disable the sending of mail to  a user about any command in her
     crontab file that fails.

-r   Remove your crontab file.

-u user
     Specify user. Only the superuser  root can specify any user other than
     herself.

Allowing and Denying Access

The  files  /usr/lib/cron/cron.allow  and /usr/lib/cron/cron.deny  let  the
system administrator govern which users can use the crontab command:

-> If cron.allow exists, then crontab  checks its contents; if a given user
   is  identified  therein,   then  she  can  use  crontab.  Obviously,  if
   cron.allow exists but is empty, then nobody can use crontab.

-> If  cron.allow  does not  exist,  then crontab  checks  the contents  of
   cron.deny. If  a given user  is identified therein, then  she cannot use
   crontab; otherwise, she can.  If cron.allow does not exist and cron.deny
   exists but is empty, then everyone can use crontab.

-> If neither file exists, then everyone can use crontab.

Format of a crontab File

A crontab command file consists  of lines separated by newlines.  Each line
consists  of six  fields separated  by white space  (tabs or  blanks).  The
first five  fields describe  the scheduled  execution time of  the command.
Respectively, they  represent the  minute (0-59),  hour (0-23), day  of the
month  (1-31), month  of  the year  (1-12),  and day  of the  week (0-6,  0
indicates  Sunday).   Each  field  can  contain  a single  integer  in  the
appropriate range,  a pair of  integers separated by a  hyphen `-' (meaning
all  integers between  the two,  inclusive), an  asterisk `*'  (meaning all
legal values), or a comma-separated list of the above forms.  The remainder
of the line gives the command to be executed at the given time.

For example, the crontab entry

    29 * * 7 0 msg henry Succotash!

means that  every hour on  the half-hour during  each Sunday in  July, cron
will invoke the command msg, and the user named henry will have the message

    daemon: Succotash!

written on his terminal's screen (if he is logged in).

crond recognizes three special characters and escape sequences in a crontab
file.  If a command contains the percent character `%', crond executes only
the portion up to the first  `%' as a command, then passes the remainder to
the command as its standard input.  crond translates any percent characters
`%' in the remainder to newlines.  To prevent the special interpretation of
a  `%', precede  it with  a  backslash, `\%'.   Finally, crond  removes the
sequence \<newline>  from the text  before it passes the  text to the
shell sh; this can be used to make an entry in the crontab more legible.

You  must pay  special attention  to permissions when  you write  a crontab
command file.  For information  on how the crontab daemon crond manipulates
permissions, see the entry for crond in the Lexicon.

Directories and Files


/usr/spool/cron/crontabs
     Main cron directory.  It holds each user's command file.  Permissions:
     700 root root.

/usr/lib/cron/FIFO
     Lock file (named pipe).  Created by cron; removed by crond/rc.

/usr/lib/cron/cron.allow
     List of allowed users.  Permissions: 600 root root.

/usr/lib/cron/cron.deny
     List of denied users.  Permissions: 600 root root.

/usr/lib/crontab
     Global  crontab  file,  used  by  previous  COHERENT  cron  mechanism.
     /usr/spool/cron Spool directory parent.  Permissions: 700 root root.

/usr/spool/cron/crontabs
     Spool directory.  Permissions: 700 root root.

See Also

commands
cron

Notes

COHERENT crontab is superset of the  command of the same name included with
UNIX System V release 3 (SVR3).  The main differences are as follows:

-> COHERENT  crontab prints  the usage  when no  options have  been chosen,
   whereas SVR3 crontab reads stdin  and can just remove the user's crontab
   file.

-> SVR3 crontab does not include option -f file_name.

-> SVR3 crontab  does not include option -u user.   Under SVR3 crontab, you
   must su to another user (e.g., uucp) before you can maintain her crontab
   file.