Date: Fri, 29 Mar 2024 04:45:58 +0000 (UTC) Message-ID: <827082197.12377.1711687558339@change.sos-berlin.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_12376_1388597928.1711687558339" ------=_Part_12376_1388597928.1711687558339 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
spooler_proc=
ess_before()
function for a preprocessor Monitor with jobs in a job =
chain that will
true
if the job should start,false
if the job should not start,./config/live
.date_calc=
ulation.
date.js library that can be included with the preprocessing monitors as in the=
following screenshot.
In order to apply both restrictions a scripted condition like this c= an be used:
function spooler_process_before() { // check time slot for the first week of a month var isJobRunEnabled =3D ( Date.today().getDate() <=3D 7 ); if ( isJobRunEnabled ) { var weekdayOffset =3D Date.parse( (1900+Date.today().getYear()) + '= -' + (1+Date.today().getMonth()) + '-01' ).getDay(); isJobRunEabled =3D ( ( 7 - weekdayOffset - Date.today().getDay() ) = >=3D 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" ); =09 spooler_task.order.state =3D 'next'; =09} =09return isJobRunEnabled; }
In order to apply both restrictions a scripted condition like this c= an be used:
function spooler_process_before() { // check execution for current date var isJobRunEnabled =3D ( Date.today().is().thursday() || Date.today().= is().friday() ); spooler_log.info( ".. job date check for run on Thursday/Friday: " + is= JobRunEnabled ); if ( isJobRunEnabled ) { // check execution for current date after the 5th and before the 15= th of month isJobRunEnabled =3D ( Date.today().getDate() > 5 && Date= .today().getDate() < 15 ); spooler_log.info( ".. job date check for run between 6th-14th of mo= nth: " + isJobRunEnabled ); } if ( !isJobRunEnabled ) { spooler_log.info( ".. moving order to state: next" ); =09 spooler_task.order.state =3D "next"; =09} =09return isJobRunEnabled; }