User Tools

Site Tools


crontab

Table of Contents

crontab

About crontab

            <p>List of files that you want to
          run on a regular schedule.</p>

Syntax

            <p>//crontab [-e] [-l] [-r]
            [filename]//</p>
            <table border''"0" cellpadding''"0" cellspacing''"0" width''"100%">
              <tbody><tr>
                <td valign''"top" width''"120">-e</td>
                <td valign''"top">edit a copy of the current user's  crontab   file,               or  creates an empty file to edit if crontab  does               not exist. When editing is complete, the  file  is               installed  as the user's crontab  file. If a user-               name is given, the specified user's crontab   file
                  is  edited, rather than the current user's crontab               file; this may only be done by a  super-user.  The
                  environment  variable EDITOR determines which editor is invoked with the  -e  option.  The  default               editor is
                  <a href''"ued.htm">ed</a>. Note that all crontab jobs should               be submitted using crontab ; you  should  not  add               jobs  by  just  editing  the crontab  file because               cron  will not be aware of changes made this way.</td>
              </tr>
              <tr>
                <td valign''"top" width''"120">-l</td>
                <td valign''"top">list the crontab   file  for  the  invoking  user.               Only a super-user can specify a username following               the -r or -l options to remove or list the crontab
                  file of the specified user.</td>
              </tr>
              <tr>
                <td valign''"top" width''"120">-r</td>
                <td valign''"top">remove  a  user's   crontab   from   the   crontab</td>
              </tr>
              <tr>
                <td valign''"top" width''"120">filename</td>
                <td valign''"top">The filename that contains the commands to run.</td>
              </tr>
            </tbody></table>
            <blockquote>
          <p>**Lines that can be in the crontab file.**
          </p><p>minute (0-59),
       hour (0-23),
       day of the month (1-31),
       month of the year (1-12),
       day of the week (0-6 with 0''Sunday).
            </p></blockquote>

Examples

            <p>**crontab
            -e '' **edits the crontab file to be used.
          </p><p>0 12 14 2** mailx john%Happy Birthday!%Time for lunch.
          </p><p>Below is a table that represents what each of the
          above fields are for.
            </p><table border''"0" cellpadding''"0" cellspacing''"0">
              <tbody><tr>
                <td valign''"top">min</td>
                <td valign''"top">hour</td>
                <td valign''"top">dayofmonth</td>
                <td valign''"top">monthofyear</td>
                <td valign''"top">dayofweek</td>
                <td valign''"top">command</td>
              </tr>
              <tr>
                <td valign''"top">0</td>
                <td valign''"top">12</td>
                <td valign''"top">14</td>
                <td valign''"top">2</td>
                <td valign''"top">**</td>
                <td valign''"top"> mailx john%Happy Birthday!%Time for lunch.</td>
              </tr>
            </tbody></table>
          <p>&nbsp;
            </p><table border''"0" cellpadding''"0" cellspacing''"0">
              <tbody><tr>
                <td align''"center">**Options**</td>
                <td>**Explanation**</td>
              </tr>
              <tr>
                <td align''"center">**</td>
                <td>Is treated as a <a href''"../jargon/w/wildcard.htm"> wild
                  card</a>. Meaning any possible value.
                </td>
              </tr>
              <tr>
                <td align''"center">**/5</td>
                <td>Is treated as ever 5 minutes,
                  hours, days, or months. Replacing the 5 with another
                  numerical value will change this option.</td>
              </tr>
              <tr>
                <td align''"center">2,4,6</td>
                <td>Treated as an OR, so if
                  placed in the hours, this could mean at 2, 4, or 6
                  o-clock.</td>
              </tr>
              <tr>
                <td align''"center">9-17</td>
                <td>Treats for any value between
                  9 and 17. So if placed in day of month this would be days 9
                  through 17. Or if put in hours it would be between 9 and 5.</td>
              </tr>
            </tbody></table>
            <p>If you wish to create a task to be performed once
            later during the day you may wish to consider using the <a href''"uat.htm">at
            command</a>.

– Main.FredPettis - 05 Mar 2009

crontab.txt · Last modified: 2013/01/28 04:29 by 127.0.0.1