Cron is a time-based job scheduler in Unix-like computer operating systems.

cron - daemon to execute scheduled commands (Vixie Cron)

Example: the following will clear the Apache error log at one minute past midnight each day.

1 0 * * * echo “” > /www/apache/logs/error_log

There is also an operator which some extended versions of cron support, the slash (’/') operator (called “step”), which can be used to skip a given number of values. For example, “*/3″ in the hour time field is equivalent to “0,3,6,9,12,15,18,21″.

So “*” specifies ‘every hour’ but the “*/3″ means only those hours divisible by 3.

# .—————- minute (0 - 59)
# | .————- hour (0 - 23)
# | | .———- day of month (1 - 31)
# | | | .——- month (1 - 12) OR jan,feb,mar,apr …
# | | | | .—- day of week (0 - 6) (Sunday=0 or 7) OR sun,-to-,sat
# | | | | |
# * * * * * command to be executed

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.