Skip to end of metadata
Go to start of metadata

We need to be able to define a repeat job that does not go beyond a specific date, i.e. does not repeat forever

Example

  • I would like a job that would repeat until, say, 01/01/2013.

Solution

First of all, you should work with schedules. Schedules are run_times that have a name and can be referenced from jobs or orders.

  • Create a NeverRun schedule which has a single start in the past, so it will never run:

     <?xml version="1.0" encoding="ISO-8859-1"?>
     <schedule name="NeverRun">
        <date date="1978-11-17">
            <period single_start="01:00"/>
        </date>
     </schedule> 
    

    (Note that you can also find this code in the NeverRun.schedule.xml file in our download.)

  • Assign this schedule to your job or order: edit the runtime parameter and remove everything until you just have <run_time schedule="NeverRun"/>.
    E.g.:

     <?xml version="1.0" encoding="ISO-8859-1"?>
     <job>
        <params/>
        <script language="shell">
            <![CDATA[
     echo halloo welt!
            ]]>
        </script>
        <run_time schedule="NeverRun"/>
     </job>
    
  • Now the trick is that you can replace schedules with other schedules for a certain period. This means you can create a repeat schedule which will replace the NeverRun schedule until 01/01/2013:

     <?xml version="1.0" encoding="ISO-8859-1"?>
     <schedule substitute="NeverRun"
              valid_to="2013-01-01 00:00">
        <weekdays>
            <day day="1 4 5">
                <period repeat="00:05" begin="06:00" end="06:30"/>
            </day>
        </weekdays>
     </schedule>
    

    (You can also find this code in our download, this time in the Repeat.schedule.xml file.)

     

 

Write a comment…