0

How to run controller action in Cron Job?

I am trying to run cron every five Minute, but cron is not working.

I put the code below, Please check :-

*/5 * * * * root wget -O - http://www.example.com/index.php/test/index/testtransact > /tmp/testtransact.log 2>&1  
0

You can refer below answer from Joseph, refer link : https://stackoverflow.com/questions/5661513/how-to-setup-magento-cron-job-and-init-action-of-the-controller

As far as I have ever seen, you cannot directly run controller actions in a cronjob, since that is not a terribly sensible thing to do outside of a user context. The easiest thing to do here is to put that functionality you need into a model and call that from the cronjob.

More information on the controller action you want to fire would be helpful in giving further advice.

Hope that helps!

0

Today, I got the answer of the question we can run this by using curl -I and give your url I wrote down side find:-

*/5 * * * * root curl -I http://www.example.com/index.php/test/index/testtransact > /tmp/testtransact.log 2>&1

Now it's successfully work.

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.