I'm writing an element for Joomla and there's a particular task that needs an update with a stats once in awhile. I must setup a cron job to get this done. The only issue is the fact that necessitates the user to visit and setup the cron to operate the php update stats script.
On installing of the component how do i instantly setup a cron project for the consumer? Is possible?
I have seen this implemented within the Akeeba backup professional component for Joomla, and so i was wishing which i would have the ability to perform the same factor.
All that you should do is write a line towards the crontab file, generally saved in
/var/spool/cron/crontabs/username. The cron daemon notice the file modification the years have transformed and reload it instantly if this awakens to complete its inspections
Theoretically you may create a crontab file and refer to it as from PHP
<?php exec("crontab $path_to_cron_file");
used it is dependent on wether the server (if you are on the hosting that is shared) enables you to achieve that.
An alternative choice (less desirable from the server load perspective but simpler for customers) is always to produce a wordpress plugin that's run every time a customer visits the website. It might check if the process continues to be run inside a specified some time and then run it if it must be run.
iJoobi.com has another solution where they've setup a server to operate cron tasks, which may then ping the particular URL online to start the procedure. (http://www.ijoobi.com/Help/jNews/jNews-Cron-Task.html)