Cron job running on shared hosting

How, please, to set the controller to call a function from another controller?

Or how to call a command job from the controller?

On my hosting I can only set CRON to the URL https:/…

Thank you

Instead of

  • calling a command from a controller or
  • calling one controller action from another

I would rather recommend you put your logic into its own Utility/Service class and use it inside as many controllers or commands as you like.
See CakeFest Virtual 2021 Day 2 - How to re use code: Utility Classes and PHP Namespaces - Kevin Pfeifer - YouTube on how to do that

1 Like

Also check this Shells - 3.10 for cron.
In my case I call it using
php full_path_to_script
from cron at vps hosting where I don’t have ssh access.
And as @KevinPfeifer said it is good idea to move somewhere your frequently used code. “Model” it’s good place, every model can be easy accessed from Controllers and other models.

1 Like