Saturday, October 20, 2012

RTFM - Read The Fine Manual

After I resolved my user's issue regarding crontab file format, I asked him to refer to the man page of crontab (man -s 5 crontab).

My colleague thinks that I am being sarcastic :-). I may be cheeky sometimes, but not this round.

The truth is the default section of crontab is section 1, which is man page for user command (see "man Intro" or "man -s 1 Intro").

If you read the "See Also" section of "man crontab", they want you to refer to crontab(5) which is section 5 of crontab

CRONTAB(1)                                                          CRONTAB(1)

NAME
       crontab - maintain crontab files for individual users (Vixie Cron)

SYNOPSIS
       crontab [ -u user ] file
       crontab [ -u user ] [ -i ] { -e | -l | -r }

DESCRIPTION
       crontab  is  the  program used to install, deinstall or list the tables
       used to drive the cron(8) daemon in Vixie Cron.   Each  user  can  have
       their    own    crontab,    and    though    these    are    files   in
       /var/spool/cron/crontabs, they are not intended to be edited directly.

...
SEE ALSO
       crontab(5), cron(8)

FILES
       /etc/cron.allow
       /etc/cron.deny
       /var/spool/cron/crontabs
...

It is only section 5 of the man page that will give you the details of the configuration. So "man -s 5 crontab"

CRONTAB(5)                                                          CRONTAB(5)

NAME
       crontab - tables for driving cron

DESCRIPTION
       A  crontab file contains instructions to the cron(8) daemon of the gen‐
       eral form: ``run this command at this time on this date''.   Each  user
       has  their  own crontab, and commands in any given crontab will be exe‐
       cuted as the user who owns the crontab.  Uucp  and  News  will  usually
       have  their  own  crontabs, eliminating the need for explicitly running
       su(1) as part of a cron command.
...
       Commands are executed by cron(8) when the minute, hour,  and  month  of
       year  fields  match  the current time, and when at least one of the two
       day fields (day of month, or day of week) match the current  time  (see
       ``Note'' below).  cron(8) examines cron entries once every minute.  The
       time and date fields are:

              field          allowed values
              -----          --------------
              minute         0-59
              hour           0-23
              day of month   1-31
              month          1-12 (or names, see below)
              day of week    0-7 (0 or 7 is Sun, or use names)

       A field may be an asterisk (*), which always stands for ``first-last''.
...

For more details of each section, simply do a "man -s SECTION# Intro" to find out more. Here is an overview of all the sections on my ubuntu:

  • Section 1 - user commands
  • Section 2 - system calls
  • Section 3 - library functions
  • Section 4 - special files
  • Section 5 - file formats
  • Section 6 - games
  • Section 7 - overview, conventions, and miscellany section
  • Section 8 - administration and privileged commands

0 Comments:

Post a Comment

<< Home