[CentOS] run script on cron job only run on first Saturdat every month???

Robert Nichols rnicholsNOSPAM at comcast.net
Mon Aug 5 13:25:30 UTC 2013


On 07/30/2013 04:58 PM, John R Pierce wrote:
> On 7/30/2013 2:32 PM, Keith Keller wrote:
>> 15 04 1-7 * 6 /home/app/oracle/backup/monthlybk.sh
>
> maybe...
>
> 	15 04 * * 6 test $(date +"%d") -le 07 && /home/app/oracle/backup/monthlybk.sh
>
> (untested)

Definitely untested!  You need to escape the "%" sign, since it is special
to cron.  Plus, you need to prevent the date command from padding its
output with a leading zero, since that would result in the illegal octal
numbers 08 and 09:

   15 04 * * 6 test $(date +"\%_d") -le 7 && /home/app/oracle/backup/monthlybk.sh

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.




More information about the CentOS mailing list