is it possible run scheduled task via click on link

samani

Member
hi
i want create simple button in the frontend to click by client to run one scheduled task.is it possible? how?
for example i have .csv file and i want import that to one table. i create that cron and it work when good when i click on run button in back-end. I want do it manually in front-end.
 
There isn't an actual controller for cron, so you can't directly do it with index.php?option=com_fabrik&view=import&task=whatever ...

But you could use the "query string" feature of the cron plugin (see tooltip on the cron settings) so the import will run on any front end page load that has &fabrikcron=xyz on the query string. Set the frequency to something short (like 5 mins) - it won't run every 5 mins, but it will allow your button to work within 5 mins of the last use.

That will then run that cron plugin, although it'll do it AFTER everything else on the page has loaded (using J!'s onAfterRender event). Just be aware of that, as it means (for example) if your button pointed to a front end list view of that list, the import cron would run AFTER the list is rendered, so you wouldn't see the changes. So one option might be to link to something like a simple article (with the cron query string appended), and in the article have a message and a link to the list.

-- hugh
 
front end page load that has &fabrikcron=xyz on the query string
Thank you hugh but maybe your mean use fabrik_cron=xyz not fabrikcron=xyz ... and for other users in future: you can use ? or & in the first of query string in different url methods...
Hugh i have other question: With Fabrik we can only use automatic or manually run scheduled task, can you suggest new way to run auto+manually (in front-end) ?
what is your idea about use new php scheduled task that run something such as Curl or Wget to run fabrik_cron=xyz and then Curl the link of Fabrik List...
in this way we have automatically run and if front-end user wants, can run manually in front-end via click on link have fabrik_cron=xyz...
 
and for other users in future: you can use ? or & in the first of query string in different url methods

That's nothing to do with Fabrik, that's just basic URL syntax. The address part and the query string are separated by a ?. Individual query string args are separated by &. I have to assume some knowledge of how URL's work when answering questions, so I don't explain every time I say anything about adding &whatever=foo to a query string ("except if it's the first query string arg in which case use ?whatever=foo because that's how URLs work").

-- hugh
 
Thank you hugh,
It seems run scheduled sometime different from that i set.for example it is run more than one...sometimes it is import csv 3 or more time to table and sometimes can not run.have you any advise?
Thank you
 
Did you enable run gating? Sometimes, if the cron job takes a long time to run, it gets kicked off again while it is still running. The 'run gating' setting prevents that.

Other than that, not really. Cron issues need hands on work, which I can't do in Community support.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top