1756816 Members
2679 Online
108853 Solutions
New Discussion юеВ

crontab job

 
Kapil Jha
Honored Contributor

Re: crontab job

Just a better way to work with cron
Put these line in crontab files.
#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).
#| | | | | commands
0 2 * * 0,4 /etc/cron.d/logchecker

Thanks to UGU :)
Kapil
I am in this small bowl, I wane see the real world......
Dennis Handly
Acclaimed Contributor

Re: crontab job

>my above setting is correct?

Yes. I finally convinced Yogeeraj that his complex version wasn't needed.
See his:
to summarize: this should work fine for you:
ust3
Regular Advisor

Re: crontab job

thx reply,

I have one addition question , if I want run on 1st of month when if it is Mon or Tue , can advise how to set ? thx

Dennis Handly
Acclaimed Contributor

Re: crontab job

>if I want run on 1st of month when if it is Mon or Tue, can advise how to set?

You want to run on first AND ONLY if it is Mon or Tue?
You reverse what Yogeeraj had. (And fiddle with it a little. :-)

00 07 * * 1,2 [ $(date +%d) -eq 1 ] && my_script #run if 1st

Note you can also put the date check in the script so you don't clutter up the crontab.