I noticed that on my_website/admin/cron page (Elgg3.3.2) only certain Cron intervals run for example fiveminute, fifteenminute, halfhour, and hourly. But daily, weekly, and monthly do not. Why is that?
Explanation or clarification would be greatly appreciated.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Maybe you don't have triggers for these intervals?
Anyway, you can activate handlers for a specific interval:
Thanks for a quick response RvR!
I do have a trigger in the start.php of my plugin like elgg_register_plugin_hook_handler('cron', 'daily', 'my_cron');
I tried the approach you provided above (elgg-cli) and hit the URL like 'my_website/cron/daily' BUT when I checked the admin/cron page, the status of daily cron is still 'Never'.
1 - Something wrong with your plugin's hook (wrong code, access permission etc).
2 - Protected Cron URLs - look at admin/security section: Administration -> Security
Tip:
You can remove -q flag temporary if you want cron logs to be saved on your server.
Trick:
Disable protection of your cron URLs.
Run this command:
To check that cron trigger is exists and runs.
Notes:
For testing you can use an -i and -f flags:
You no longer need to setup a gazillion jobs for each period.
You only need to setup one cron job that hits the main command every minute.
Elgg's cron handler will determine which cron handlers are due and will run them.
1. elgg_register_plugin_hook_handler('cron', 'daily', 'my_cron');
function my_cron(\Elgg\Hook $hook) {
error_log('testing my cronjobs');
}
That is my hook - just for testing. But it did not return the error message in the httpd log.
2. I checked admin/security section and 'Protect the /cron URLs' is disabled.
Your site on SSL?
It's on the dev environment so it is not on SSL.
Then force your cronjob:
And use something like this:
Thanks RvR!
Now I saw that message in the terminal window as well as the cron log for 'daily' interval in admin/cron.
Another issue I found regarding cronjobs. Daily cron runs as expected but it does not show the log in Admin > Information > Cron. It shows the log only when I manually run the vendor/bin/elgg-cli cron -i daily -f.
Make sure the cron account and the webserver account are the same.
Otherwise the cron account will write the logfile, but the webserver won't be able to read it
- Previous
- 1
- 2
- Next
You must log in to post replies.