I have created 2 cron jobs on my server(ubuntu), but only one works.

*/5 * * * * curl -s http://www.example.com/cron.php?cron_key=TzVesnZuNqR4mkjv_LgBemUV-oYvsfYalyHOfDtL4cc

*/5 * * * * curl -s http://www.example.gr/cron.php?cron_key=OrrbXhtfSEZ2NI7BlHjAPRtMT_ENAKaz68iH86Kl5wI

In my log file at /var/log/syslog there is an error stating "Cron could not run because an invalid key was used." but my key is correct. When I launch manually, it runs the cron successfully.

I can't understand why this is happening. Is there any solution?


The URL of the cron.php page requires a "cron key" to protect against unauthorized access. Your site's cron key is automatically generated during installation and is specific to your site. The full URL of the page, with the cron key, is available in the "Cron maintenance tasks" section of the Status report page at Administration > Reports > Status report.

As an example for how to set up this automated process, you can use the crontab utility on Unix/Linux systems. The following crontab line uses the wget command to visit the cron.php page, and runs each hour, on the hour:

0 * * * * wget -O - -q -t 1 http://example.com/cron.php?cron_key=YOURKEY

Replace the text "http://example.com/cron.php?cron_key=YOURKEY" in the example with the full URL displayed under "Cron maintenance tasks" on the "Status report" page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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