Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • The standard job configuration as offered by JOE allows to specify either specific days, e.g. first Monday of a month, or specific dates, e.g. 1st to 7th.
  • In order to apply both restrictions a scripted condition like this can be used:

    Code Block
    languagejs
    titlePreprocessing Monitor for job1 in job_chain1
    collapsetrue
    function spooler_process_before() {
    
        // check time slot for the first week of a month
        var isJobRunEnabled = ( Date.today().getDate() <= 7 );
        if ( isJobRunEnabled ) {
            var weekdayOffset = Date.parse( (1900+Date.today().getYear()) + '-' + (1+Date.today().getMonth()) + '-01' ).getDay();
            isJobRunEabled = ( ( 7 - weekdayOffset - Date.today().getDay() ) >= 0 );
        }
        spooler_log.info( ".. job date check for run on first week of month: " + isJobRunEnabled );
    
        if ( !isJobRunEnabled ) {
            spooler_log.info( ".. moving order to state: next" );
    	    spooler_task.order.state = 'next';
    	}
    
    	return isJobRunEnabled;
    }

...

  • The standard job configuration as offered by JOE allows to specify either specific weekdays or a range of days.
  • In order to apply both restrictions a scripted condition like this can be used:

    Code Block
    languagejs
    titlePreprocessing Monitor for job2 in job_chain2
    collapsetrue
    function spooler_process_before() {
    
        // check execution for current date
        var isJobRunEnabled = ( Date.today().is().thursday() || Date.today().is().friday() );
        spooler_log.info( ".. job date check for run on Thursday/Friday: " + isJobRunEnabled );
    
        if ( isJobRunEnabled ) {
            // check execution for current date after the 5th and before the 15th of month
            isJobRunEnabled = ( Date.today().getDate() > 5 && Date.today().getDate() < 15 );
            spooler_log.info( ".. job date check for run between 6th-14th of month: " + isJobRunEnabled );
        }
    
        if ( !isJobRunEnabled ) {
            spooler_log.info( ".. moving order to state: next" );
    	    spooler_task.order.state = "next";
    	}
    
    	return isJobRunEnabled;
    }

...