Bladeren bron

NEW add option --force on CLI cron_run_jobs.php
This allow to execute cron even if date is not yeat reached

Laurent Destailleur 2 jaren geleden
bovenliggende
commit
41175b73ee
1 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 4 2
      scripts/cron/cron_run_jobs.php

+ 4 - 2
scripts/cron/cron_run_jobs.php

@@ -92,7 +92,7 @@ $hookmanager->initHooks(array('cli'));
 $now = dol_now();
 
 @set_time_limit(0);
-print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=".$userlogin." ***** ".dol_print_date($now, 'dayhourrfc')." *****\n";
+print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - userlogin=".$userlogin." - ".dol_print_date($now, 'dayhourrfc')." *****\n";
 
 // Check module cron is activated
 if (empty($conf->cron->enabled)) {
@@ -250,7 +250,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
 		}
 
 		//If date_next_jobs is less of current date, execute the program, and store the execution time of the next execution in database
-		if (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now)) {
+		if ($forcequalified || (($line->datenextrun < $now) && (empty($line->datestart) || $line->datestart <= $now) && (empty($line->dateend) || $line->dateend >= $now))) {
 			echo " - qualified";
 
 			dol_syslog("cron_run_jobs.php line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc'));
@@ -325,4 +325,6 @@ function usage($path, $script_file)
 	print "30 3 * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
 	print "For example, to run pending tasks every 5mn, you can add this line:\n";
 	print "*/5 * * * * ".$path.$script_file." securitykey userlogin > ".DOL_DATA_ROOT."/".$script_file.".log\n";
+	print "\n";
+	print "The option --force allow to bypass the check on date of execution so job will be executed even if date is not yet reached.\n";
 }