peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
811 stars 144 forks source link

Passing date will not execute the code in background #139

Open albarqx opened 1 year ago

albarqx commented 1 year ago

Hi,

When I am passing ->date() here script will not run .. once I remove ->date it will work ..

$scheduler = new Scheduler(); $scheduler->call( function ($job) { return "\n".date('Y-m-d H:i:s'); }, [ $job ], 'myCustomIdentifier' )->date('2023-01-19 03:18')->output('my_test.log'); $scheduler->resetRun(); $scheduler->run();

When I print $scheduler I got this

[executionTime:GO\Job:private] => Cron\CronExpression Object

  | (   | [cronParts:protected] => Array   | (   | [0] => 18   | [1] => 03   | [2] => 19   | [3] => 01   | [4] => *   | )

[runInBackground:GO\Job:private] => 1, [creationTime:GO\Job:private] => DateTime Object

  | (   | [date] => 2023-01-19 03:16:22.271374   | [timezone_type] => 3   | [timezone] => Asia/Riyadh   | )

but still not executed ..

If I run the script manually on this exact time then it will work ... if wait it to be done automatically then it will not ..

Did I miss something?