Clarity

Expand all | Collapse all

Scheduling a job to run every other week (or, every two weeks).

  • 1.  Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 05, 2014 11:43 AM

    Hi folks.

      I don't think I've had to schedule anything bi-weekly yet. I've read online that '/2' mean 'every two', thus 0 7 * * 3/2 should mean 'ever other Wednesday at 7AM'. The Crontab box in the job schedule doesn't see this as a valid format.

     

    Any idea on a 'every two weeks' or, more specifically 'every other Wednesday' crontab that the scheduler interface will accept?



  • 2.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 05, 2014 01:15 PM

    Have you tried this ?

     

    Start Date - Give as Wednesday

    Start Time - Give as 7 AM

     

    In the Cron, use the below

    0 7 * * */2


    NJ



  • 3.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 05, 2014 03:03 PM

    Thanks NJ - it took the syntax. This reads to me as '7 AM every other day', but I'll remain curious. Let's see what happens!



  • 4.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 07, 2014 02:06 PM

    Did you try 0 7 * * WED/2



  • 5.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 07, 2014 02:12 PM


  • 6.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 08, 2014 08:10 AM

    */2 actually means 'twice daily'. Ist nicht so gut.



  • 7.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 08, 2014 09:53 AM

    Did you check this ?

     

    0 0 1-7,15-21 * 3

     

    cron - How to schedule a biweekly cronjob? - Server Fault

     

     

    NJ



  • 8.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 08, 2014 10:16 AM

    navzjoshi00 wrote:

     

    Did you check this ?

     

    0 0 1-7,15-21 * 3

     

     

    That implements "every first and third Wednesday in the month" - which might be fine, but isn't "every other Wednesday"



  • 9.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 08, 2014 10:22 AM

    Hi,

     

    NJ ... your last thread seems to be the nearest solution what Robert is looking for but this Solution is going to fail if month is having 5 Wednesday like July 2014.

     

    This Logic is going to fail ....

     

    -Gurjeet



  • 10.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 09, 2014 10:20 AM

    How about this - Create a process and run the job after checking via gel, the condition which Rob is looking for. Then use the Execute a Process job to run the process (schedule the job to run every Wednesday). I guess that should take care of it ?

     

    NJ



  • 11.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 09, 2014 10:43 AM

    Hi all.

      Thanks for all the ideas - but let's reel this one in a bit. I can implement the logic in other ways - but I'd like to build something that anyone can see & maintain - thus the problem to solve is '7AM every other Wedneday' with Clarity's OOTB scheduling capability (crontab).

     

       Google tells me a lot depends on the library your app is using for Crontab. Depending upon the library, "0 7 * * 3/2" could do "every other Wednesday" (like I need), "Twice every Wednesday", or 'Nothing - unrecognized".

     

       The Crontab string entry box doesn't see 0 7 * * 3/2 as valid syntax. Let's just say I'm past the UI validation issue and will know more by the 17th.

     

    Best case scenario is this works, then the enhancement (bug?) is to fix the validator to accept the format.

     

    FYI - just to be thorough I've also opened a case with Support requesting how CA recommends one schedule something 'every other week'. This shouldn't be something we're engineering here in the forums, IMHO.

     

    I'll keep ya'll posted.



  • 12.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Sep 09, 2014 11:51 AM

    Thanks Rob, for sharing this. Will await the outcome of your conversation with them.

     

    NJ



  • 13.  Re: Scheduling a job to run every other week (or, every two weeks).
    Best Answer

    Posted Oct 22, 2014 04:57 PM

    Hi All.

      I wanted to circle back on this. CA Support didn't have a solution either so we thought we'd just give the "3/2" syntax above a shot.

    crontab.jpg

     

    The scheduler doesn't recognize it.

    not scheduled.jpg

     

    Our solution is to schedule the process to run weekly, then, in the SQL code that builds the list of objects, have it Null Out the results on even weeks, thus giving the the result of "running every other week".

    -- this demonstrates how to find even and odd weeks
    SELECT CASE WHEN DATEPART(ISO_WEEK, GETDATE()) % 2 = 1 THEN 'odd' ELSE 'even' END
    
    
    
    

     

    HTH the next forum traveler.



  • 14.  Re: Scheduling a job to run every other week (or, every two weeks).

    Posted Oct 23, 2014 03:39 PM

    Thanks for sharing.