On Fri, Jun 27, 2008 at 1:48 PM, smart monty <[EMAIL PROTECTED]> wrote: > Hi Alll, > > I want to set cron in Unix on Alternate friday of every Month for generate > some report.can anybody suggest me how to do it ?
date +%W will give you the week of the year. If you divide this by 2, and get no remainder (using the %2 operator), it means the week is even. If you get a remainder, it means the week is odd. So to run your cron job on alternate fridays, you have to run it either when the remainder is zero, OR when the remainder is not zero, but not both. Heres the complete logic: 1.On every Friday 2.Check the remainder 3. If remainder is 0, run the script. Haven't tested it at all, so there might be some caveats. Regards, NMK. -- First they ignore you. Then they laugh at you. Then they fight you. Then you win. -- Mohandas Karamchand Gandhi
