1847912 Members
3457 Online
104021 Solutions
New Discussion

About the crontab job

 
hangyu
Regular Advisor

About the crontab job

If I set the crontab job to as below , then when the job will be run ? 2th or Tuesday ? 2th and Tuesday ? thx



0 10 2 * 2 script
4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: About the crontab job

The day of month and weekday fields in a crontab are a logical OR so that your cron job will run on the 2nd of every month and every Tuesday.
If it ain't broke, I can fix that.
skt_skt
Honored Contributor

Re: About the crontab job

#------------------------------------------------------------------------------
# Minute Hour Month Day Month Weekday Command
# 0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#------------------------------------------------------------------------------

Every month on date 2 and if it is a Tuesday
M.S. BALAJI
Occasional Advisor

Re: About the crontab job

Hi,

From man page

Note that the specification of days can be made in two fields: monthday and weekday.
If both are specified in an entry, they are cumulative. For example,

0 0 1,15 * 1 command

runs command at midnight on the first and fifteenth of each month, as well as every Monday. To specify days in only one field, set the other field to asterisk (*). For example,
0 0 * * 1 command

runs command only on Mondays.

Regards,
BALAJI M.S
Yogeeraj_1
Honored Contributor

Re: About the crontab job

hi,

these are a few lines that are always found in my crontabs:

#*******************************************************************************
# min|hour |day |month|day |script
# | |of mo| |of wk|
#----|-----|-----|-----|-----|--------------------------------------------------
#*******************************************************************************
#*******************************************************************************
# END OF TABLE day0->Sunday day6->Saturday
#*******************************************************************************


makes editing easy.

kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)