0

When manually calling the cron.php like www.example.com/cron.php , it doesn't runs for the first time.

After that it runs.

Dont know why this happening.

2 Answers 2

3

The cron.php does 3 things.

  • run the jobs scheduled at the current point
  • schedule jobs for the next time interval, to run the next time.
  • clean successful jobs.

When you run it first time you don't have anything scheduled so nothing is executed. But it schedules jobs for the next time interval.
The second time you run it you have scheduled jobs and they get executed.

To get an idea of what this means, clean the table cron_schedule, run the cron once and you will see it will be populated with values.
Then run the cron again and you should see the previous jobs with a success status and additional jobs added to the table.

2

This could be happening because that when it was run the first time, there were outdated scheduled items in your cron_schedule table - and when you run it the second time - it will run the scheduled tasks.

Do you have it scheduled to run every X minutes?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.