Cron Job

Mallikarjun H T - Jan 21 '21 - - Dev Community

What is cron?

The origin of the name cron is from the Greek word for time.

Hear is an quick example for backing up my system at (01 01) every day.

01 01 * * * /usr/local/bin/rsbu -vbd1 ; /usr/local/bin/rsbu -vbd2

well i presume u dont get most of it. don`t worry i got it covered for you. i will explain each and every step.

First there are 5 places we need to understand those are

  • sec 0 - 59
  • min 0 - 59
  • Hr 0 - 23 in 24 Hr fashion
  • day 0 - 30/31
  • month 1 - 12
  • week 0 - 6 (0 being sunday )


| ............... sec (0 -59)
| | ............. minute (0 - 59)
| | | ........... hour (0 - 23)
| | | | ......... day of month (1 - 31)
| | | | | ....... month (1 - 12)
| | | | | | ..... day of week (0 - 6)
| | | | | |
* * * * * *

Examples

  • every year 1st of jan * * * 1 1 *
  • every hour 0 59 * * * *
  • every day at 12 0 * 12 * * *
. . . . . . . . . . . . . . . . . . . . .