mcclnx mcc
2013-Jul-30 20:43 UTC
[CentOS] run script on cron job only run on first Saturdat every month???
we have CENTOS 5.5 on DELL server.? One of our script need run on first Saturday every month. ?We have following setup on cron job but it run every Saturday.? 15 04 1-7 * 6 /home/app/oracle/backup/monthlybk.sh ? Any one know how to fix it? Thanks.
John R Pierce
2013-Jul-30 21:01 UTC
[CentOS] run script on cron job only run on first Saturdat every month???
On 7/30/2013 1:43 PM, mcclnx mcc wrote:> we have CENTOS 5.5 on DELL server. One of our script need run on first Saturday every month. > > We have following setup on cron job but it run every Saturday. > > 15 04 1-7 * 6 /home/app/oracle/backup/monthlybk.sh > > Any one know how to fix it?I don't believe cron has any concept of the first day-of-week of each month, so you'll need to put some code into your script to exit if its NOT the first day-of-week of each month. -- john r pierce 37N 122W somewhere on the middle of the left coast
Joseph Spenner
2013-Jul-30 21:42 UTC
[CentOS] run script on cron job only run on first Saturdat every month???
>From: mcclnx mcc <mcclnx at yahoo.com.tw>>>we have CENTOS 5.5 on DELL server.? One of our script need run on first Saturday every month. > >We have following setup on cron job but it run every Saturday.? > >15 04 1-7 * 6 /home/app/oracle/backup/monthlybk.sh > >Any one know how to fix it?That's pretty clever, and it looks like it should work. Maybe something is taking priority? I'd try some experimentation.? Try: 15 04 1-7 <today.day.number> 6 touch /tmp/foo.test 15 04 1-7 <today.day.number> * touch /tmp/foo.test 15 04 1-7 * * touch /tmp/foo.test 15 04 * * 6? touch /tmp/foo.test etc. It might take a while, but you'll find it eventually! I had a similar problem with Debian, but it turned out to be a weird timezone issue confusing me.
Mark LaPierre
2013-Aug-04 18:59 UTC
[CentOS] run script on cron job only run on first Saturdat every month???
On 07/30/2013 04:43 PM, mcclnx mcc wrote:> we have CENTOS 5.5 on DELL server. One of our script need run on first Saturday every month. > > We have following setup on cron job but it run every Saturday. > > 15 04 1-7 * 6 /home/app/oracle/backup/monthlybk.sh > > Any one know how to fix it? > > Thanks. > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >1 2 3 4 5 /root/backup.sh * * * * * command to be executed - - - - - | | | | | | | | | ----- Day of week (0 - 7) (Sunday=0 or 7) | | | ------- Month (1 - 12) | | --------- Day of month (1 - 31) | ----------- Hour (0 - 23) ------------- Minute (0 - 59) 15 4 1-7 * 7 /home/app/oracle/backup/monthlybk.sh -- _ ?v? /(_)\ ^ ^ Mark LaPierre Registered Linux user No #267004 https://linuxcounter.net/ ****