What is the difference between executing these two commands from the console:

php -f cron/cron-minute.php force 

and the next

 php -f cron/cron-minute.php 

UPD here's the code inside

 <?php $force = isset($argv[1]); $pidFile = __FILE__.'.pid'; $pidDate = @file_get_contents($pidFile); if (!$force) { if ($pidDate > date('Ymd H:i:s', time() - 3600)) { print "\n\nProcess already running...\n\n"; exit(); } } file_put_contents($pidFile, date('Ymd H:i:s'), LOCK_EX); require(dirname(__FILE__).'/../packages/Engine/include.2.6.php'); Machine::Get()->eErrorReporting(); if ($force) { Loader::Get()->setMode('debug', true); } // генерируем событие try { $event = Events::Get()->generateEvent('afterCronHour'); if ($force) { // показываем что будем запускать $a = $event->getObserversArray(); foreach ($a as $object) { print 'Observer '.get_class($object)."\n"; } } $event->notify(); } catch (Exception $e) { print $e; } unlink($pidFile); print "\n\ndone.\n\n"; 
  • 2
    We need to look at the source code of this cron-minute.php or description. What is this product? The "force" argument is passed to the php script and processed there. - Sergiks 1:01 pm
  • Can't I see if ($force) { ... } ? - Deadooshka
  • did not immediately understand that $ argv [1] takes force as an argument from the command line - Igor Kalamurda

1 answer 1

If any argument is specified (not necessarily "force"), then the script will try to start the tasks in any case, even if they were already started less than an hour ago. In addition, debug mode will be enabled.

  • please tell me what do you mean debug debug mode? - Igor Kalamurda
  • one
    I have no idea, it is necessary to look, what kind of Loader class you have mentioned there: Loader :: Get () -> setMode ('debug', true); - Sergiks pm