Well, I am new to Hosting, I read a lot about cron jobs, to add a cron job in cpanel you have to specify the time at what time to execute, we need to specify the file path, but the question here I have is how can I specify the path here, I have a controller where cron job code and other code is written.
How can I specify the filename here, I have particular routes like this
https://exampple.com/cron_execute
How can I mention that in Cpanel?
P.s I am not using laravel cron controller it is my own custom controller.
3
Answers
In Cron job you can’t use URL in order to run some scripts.
You have to create a Artisan command (check this https://laravel.com/docs/6.x/commands and specify your laravel project version in the top right corner menu) and than in the cPanel you have to register that command like
cd /path/to/your/root/file/of/the/laravel/project/ && php artisan schedule:run
and this will run theschedule:run
command that will take care of running your command when you have specified, for example withdaily()
,schedule:run
will run your command each midnightIn cpanel with the specific domain name you can do it this way
/usr/local/bin/ea-php99 /home2/accounname/https://exampple.com/cron_execute_file
Cpanel Cron job Reference
Set the following command syntax in the cPanel-> cronjob section
remember to configure time interval settings like min, hour, day, month, etc to run the cron.