How to Register elgg_cron_periods in Elgg3.2?

I have cronjob running every afternoon for my custom plugins. Below block of code works in Elgg2.3* but not Elgg3.2*.

//in my plugin/start.php

$all_crons = elgg_get_config('elgg_cron_periods');

$all_crons[ ] = 'afternoon';

elgg_set_config('elgg_cron_periods', $all_crons);

elgg_register_plugin_hook_handler('cron', 'afternoon', 'afternoon_cron_handler');

 

//in /etc/cron.d/my_crontab

30 16 * * *  root  /usr/bin/GET  https://mysite/cron/afternoon/

I followed instructions on how to trigger cron in Elgg3.2* here: http://learn.elgg.org/en/3.2/admin/cron.html. After running vendor/bin/elgg-cli cron -i afternoon in my wwwroot directory, I faced 'Cache path is not writable' issue similarly to this thread https://github.com/Elgg/Elgg/issues/12190. I have my data directory permission set to 750 as recommended.

Please advice on how to trigger custom intervals in crontab for Elgg3.2*.

Thanks!

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking