Post by Joe1234 » Fri Jul 12, 2024 10:29 pm

I want to run a cron job and function but I can't get it to work.

What I've been doing to set up cron job functions is to put a script in a dedicated cron dir outside the OC dir and running it like:

Code: Select all

php -f /home/path/to/file.php function_name
So I tried to do that with the function left in the model dir, but it doesn't work.

Code: Select all

php -f /home/path/to_file/catalog/model/extension/module/file.php function_name
How do I activate a function by ways of cron if the file and function is left in the model dir (standard model file, not a dedicated script file)?

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by ADD Creative » Fri Jul 12, 2024 11:14 pm

Is the path to your php correct? Does your function use any OpenCart functions? If so it would probably be easier to make a controller and call with curl or wget.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by Joe1234 » Sat Jul 13, 2024 4:35 am

Thanks. I went ahead and put a function in the controller to call the model and called the controller from the cron.

v3.0.4.0 php 8.1
I'm here for a reason, if your response is contact a/the developer, just don't reply.


Active Member

Posts

Joined
Sat Jan 01, 2022 5:47 am

Post by paulfeakins » Mon Jul 15, 2024 5:56 pm

Joe1234 wrote:
Sat Jul 13, 2024 4:35 am
Thanks. I went ahead and put a function in the controller to call the model and called the controller from the cron.
And did that do it? If so please add [SOLVED] to the start of this topic title.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 18 guests