Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removing social links

...

Info

If you have cPanel, cron jobs can be managed directly in your control panel without directly modifying a crontab. See cPanel's Cron Jobs Featureen cPanel [Como configurarlos] for more information.

Table of Contents

...

Code Block
languagetext
┌───────────── minute 
│ ┌───────────── hour 
│ │ ┌───────────── day of the month 
│ │ │ ┌───────────── month 
│ │ │ │ ┌───────────── day of the week 
│ │ │ │ │ 
│ │ │ │ │ 
│ │ │ │ │ 
* * * * *

Above diagram courtesy of Wikipedia.

FieldAccepted Values
minute0-59
hour0-23
day of the month1-31
month1-12 or names (see below)
day of the week0-7 (Sunday is 0 or 7) or names

Cron jobs are run whenever the  minute hour , and  month  fields match the current time, and when  at least one of  the  day of the month , or  day of the year  fields matches.Names for days of the week, or months are the first three letters of a day or month (e.g Mon for Monday, Oct for October).

...

There are a handful of special time shorthand that may be used instead of the five date and time fields.

ShorthandValue
@rebootRuns once after a reboot.
@yearly or @annuallyRun once a year (0 0 1 1 *).
@monthlyRun once a month (0 0 1 * *).
@weeklyRun once a week (0 0 * * 0).
@dailyRun once a day (0 0 * * *).
@hourlyRun once an hour (0 * * * *).

Examples

A command that runs every minute:

...

Code Block
languagetext
titleRange
0,10,20,30,40,50 * * * * /path/to/command

...


Code Block
languagetext
titleStep
*/6 * * * * /path/to/command

...

Code Block
languagetext
Hourly message. 
Hourly message. 
Hourly message.

If you don't care about the normal output of a cron job, and only want to be notified when it encountered an error, you can redirect the output to /dev/null.

...