Tjeneste-oppgradering: Følg linken for nærmere status vedrørende migrering, for generelle spørsmål og svar se vårt hjelpesenter.

Create cron job in cPanel


EXPERIENCING PROBLEMS WITH OUR SERVICES? RUN A DIAGNOSE FIRST TO SAVE YOURS AND OUR TIME

Added: 10.03.2014 23:26:29     Last updated: 11.05.2019 14:04:31

This guide details how to proceed to create a cron job to run script/commandos automatically at certain time intervals. The guide requires you to first log into cPanel.

Step 1:
Click on the icon for "Cron jobs" as shown in the screenshot below:

Creation of cron job in cPanel


Step 2:

  1. Every time a cron job is run, the result is sent to an email address. We type the email address we want the results to be sent to.
  2. Click "Update email" if you make changes in which email it should be sent to.
  3. In this drop down menu you can choose between the most common settings for when the script should run. Here we have chosen that it shall be run every day, at midnight.
  4. You can also decide yourself exactly when you want the job to be run:
    Minute: Choose which minute of the hour the job should run. We choose 0 to run skript.php the first minute of the hour.
    Hour: Choose which hour of the day the job should run. We choose 0 to run skript.php the first hour of the day (midnight).
    Day: Choose which day of the month the job should run. We choose * to run skript.php every day.
    Month: Choose which month of the year the job should run. We choose * to run skript.php every month.
    Weekday: Choose which day of the week the job should run. We choose * to run skript.php every weekday.
  5. We have to specify which script we want to run (including full path from root). On our servers this will be "php -q /home/"your username"/public_html/skript.php" where we have saved skript.php in the root of the folder "public_html". You can of course place the script that should be run in a sub folder if you want
  6. Click "Add Cron job".
Basic or advanced set up of cron job in cPanel


Step 3:

  1. Here you will get a confirmation that your cron job has been added.
  2. If you need to make changes in the script you want to run, or make other changes, click "Edit".
  3. If you want to delete the job, click "Delete".
List of cron jobs in cPanel

Done
We have not set up a cron job to run the file "skript.php" for our account, once a day.
You can create as many cron jobs as you want, but please pay attention to the fact that cron jobs in certain settings can use a lot of resources in a server.