How to add cron job on hosting?

Hosting account allows you to add recurring cron jobs. It is a special program to periodically call up commands, which allow you to automate activities related to the operation of your website or shop.

Adding cron task on hosting

1. Log in to Your cPanel account.

2. In the Advanced section, click on "Cron Jobs".

dd cron job - step 1

3. On new page, complete fields of form for adding a cron job accordingly:

Add cron job - step 2

  • Common settings - a predefined list of the most common cron job schedulers to choose from,
    NOTE: selecting any item from this list will automatically complete the fields: minute, hour, day, month and working day,
  • Minute - minute that the cron job command is to be run,
  • Hour - hour at which the cron job command is to be run,
    NOTE: UTC time zone is set on servers, therefore it is necessary to take a correction for the time shift relative to the local user's time, e.g. CEST timezone.
  • Day - day on which the cron job command is to be run,
  • Month - month in which the cron job command is to be run,
  • Working day - on which day of the week the cron job command is to be run,
  • Command - a command to be run by a cron job. Below are some examples of commands:
    • calling a PHP script with full mute:
      /usr/local/bin/php /home/thecamels/public_html/cron.php >/dev/null 2>&1
    • calling a PHP script using a specific version of PHP:
      /usr/local/bin/ea-php73 /home/thecamels/public_html/cron.php >/dev/null 2>&1
    • calling up the website address:
      /usr/bin/curl "https://thecamels.eu/modules/import/import.php?file1=6455345&securekey=osnfcodnwoe2wd29293"
    • calling the website address with full mute:
      /usr/bin/curl "https://thecamels.eu/modules/import/import.php?file1=6455345&securekey=osnfcodnwoe2wd29293" >/dev/null 2>&1

cron, hosting, cykliczne zadanie, automatyzacja, cron task, zadanie cron


Also Read