How to route a CRON/TERMINAL request

I need to access to a controller throught a terminal request.
If I try something like this:

$app->any(’/’, \App\Controllers\CronController::class.’:index’);

I get an error becouse of the request comes from terminal (no GET / POST / …).

How can I access to my CronController?

Hi @beppesan

You can use try to use the curl or wget command to send HTTP requests.

Hi @odan
Thanks for you reply.
If possible I’d like to avoid curl or wget because of with these functions we can have timeout problems.

For this reason (timeout), cronjobs should not be invoked via HTTP.

You may better call a simple console script with “php filename.php” in crontab that starts the actual service script. So you don’t have to use the Slim router and dispatcher for it. This means that you need to implement your business logic within application services classes.