Skip to content

How do I set up a cronjob through cPanel?

Back to web hosting

It can be convenient to perform certain tasks at fixed times, for this you can set up a cronjob.
For example, you can set it to periodically empty the cache or to call a PHP function at a specified time.

In this tutorial, we will explain how to set up a cronjob in DirectAdmin, after which we will also explain what the different settings mean.

  1. Log in to the hosting of the domain name in question.
  2. Under "Advanced," navigate to "Cron tasks."
  3. Under "Add new cron task" you can specify the desired settings.
    These settings will be explained below, in cPanel you can use "Default settings", these are common settings that can be used quickly.
  4. Once all settings are entered you can click on "Add new cron job".

The cron job that has just been created is visible at the bottom of the page.
Should you wish to make a change you can click on the pencil next to the cronjob to update it, or on the trash can to delete it.


Which settings should I use?
A cronjob is executed based on Minutes, Hours, Days, Months and days of the week.
You can also enter a "*" and it will be executed on every minute, hour, day, month, or day of the week.

  • Minutes: This will be executed on the minute indicated, for example if you enter 30 it will be executed on the 30th minute of the hour.
  • Hour: This will be executed at the hour indicated, for example 19 can be entered here to have it executed at the? 19th hour.
  • Day of the month: Here the day of the month is asked, so you can execute a cronjob on every 20th of the month.
  • Month: Here the month is requested. Thus 6 can be entered here to execute the job every June.
  • Day of the week: Here the day of the week can be specified, for example, if 6 is entered here it will be executed on Saturday.


With the above examples, if the assignment falls on a Saturday (this is due to the day of the week) on June 20, it will be executed at 19:30.

Command: This is the command that can be executed on the server. It allows you, for example, to invoke a .php file, or delete files on the server.

Back to web hosting