peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
808 stars 143 forks source link

Set for later in the month, but firing anyway #76

Closed jamminjames closed 5 years ago

jamminjames commented 5 years ago

I have a cron job set up like so, following the directions. It's not supposed to fire until the 12th of the month, and this is the 10th:

$renewalemail = new Scheduler();
$renewalemail->php('cron_renewalemail.php')->at('15 10 12 * *');
$renewalemail->run();

But it's firing anyway. What am I doing wrong? Thanks.

jamminjames commented 5 years ago

I figured this out. I had other cron jobs in the same file, and wasn't able to get them to all run, but didn't realize I had to have the $scheduler = new Scheduler(); line just once, before any cron jobs, and $scheduler->run(); just once at the end. I thought you had to start and end each one that way. This is also why I was experimenting with naming them differently (using $renewalemail = new Scheduler(); etc).

So, that was messing everything up.