peppeocchi / php-cron-scheduler

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

Minute Error #124

Open suaterkilic opened 3 years ago

suaterkilic commented 3 years ago

Hello,

This library is great! but I have a problem.

this my code;

                $scheduler->php(__DIR__ . "/" . $taskFile)
                ->onlyOne()
                ->output([
                    'mylog.log'
                ])
                ->at("*/$taskTime * * * *");

I set the time as 10080 minutes or 569 minutes but the system is doing the task every hour. Why? what should i do?

peppeocchi commented 3 years ago

Hi @suaterkilic I am not sure what you mean, you set */10080 * * * *? You can only set values between 0 and 59 as a valid cron expression (ref) It might be better to understand what you are trying to do, in your use case it might work a Datetime execution, for example if $taskTime is calculated based on - e.g.- a last check and you want to add 10080 minutes to that last check, you might calculate a specific date and time and set it like

$scheduler->php('script.php')->date(new DateTime('2021-08-01 12:39'));