skip to Main Content

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


  1. 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 the schedule:run command that will take care of running your command when you have specified, for example with daily(), schedule:run will run your command each midnight

    Login or Signup to reply.
  2. In 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

    Login or Signup to reply.
  3. Set the following command syntax in the cPanel-> cronjob section

    wget -O - https://www.your-domain.com/cron-path >/dev/null 2>&1
    

    remember to configure time interval settings like min, hour, day, month, etc to run the cron.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search