hmmm nice work around.. That means he will have to use two scripts.. A -- the actual script and.. B -- the week check script
script B will check for alternate week as per Nadeem's logic. If the logic is met (i.e. alternate week = true) then call (excute) script A. In cron call script B on every friday. I think this should work. Good one.. NMK ! Regards, DoOrsOfpErcEpTiON --- In [email protected], "Nadeem M. Khan" <[EMAIL PROTECTED]> wrote: > > 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 >
