Jump to content

Assistance with cron jobs module (PS 1.7)


Recommended Posts

Hi. 

I'm building a module to sync my stock and I got all the code working manually from the module config interface, but I'd also like to use the cron jobs module hook in order to automate this as well. I already use an external cron job on my host server to call the cron jobs module controller, however my hook in the module never seems to run. I've also called the URL that the module provides manually and I get the cronjobs_prestashop text, which means it did enter the controller, but the job still says last execution was Never. 

The url: https://domain/admin/index.php?controller=AdminCronJobs&token=MY_TOKEN should have activated the job if it is set up to run hourly and has never run since it has been hooked. 

My code looks something like: 

 

public function hookActionCronJob($params)
    {
        $this->syncStock();
    }

The method works in the admin configure interface, but seems to never be called here, I've also registered the hook upon install and it does show up in the cron jobs list in the cron module, but still, never runs. 

I did manage to once run it locally but I fear I didn't manage to catch my steps, and since then, it won't run on either my local installation and the actual production. 
The following post also seems to touch on the same topic, and is fairly recent, but as it looks like, it hasn't gotten a lot of answers either. The article inside seems to do it, but I have yet to cross reference the code to see if I'm doing anything any different yet. 

 

If anyone has some idea, or some tips, hints or insight I would greatly appreciate it. 

Thanks, 
Dragos.

Link to comment
Share on other sites

Hello. That is exactly what I am going to do. 

The module DOES run the job assigned to it, but... it ran for the first two days, then two days pause then ran again for a day. 

I'd have to say based on my research so far that you are right and it is EXTREMELY unreliable :(. 

There are examples of a direct CRON url with token in the currency module, I'll just grab the code from there. 

Thank you for taking the time to confirm my suspicions.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...