cPanel - Guide e configurazione search
clear

How to create a cron job in cPanel

A cron job allows you to execute a command (or a series of commands or a PHP script), automatically: such as, for example, the scheduled erase of temporary files (not to run out of the available disk space), the detection and acquisition of data from a specific source, the update of information via RSS feed and so on.
It's a very useful tool to plan the execution of the operations in your website without the obligation to make them periodically by yourself.

To set a cron job, log-in to your cPanel control panel and click, in the "Advanced" tab, "Cron jobs".




You can create a cron job by filling in all the required fields and entering the specific timing of execution of the process.


cron job


In "Common settings" enter a standard configuration concerning the timing and specify hour, day and month of the execution. In "Command" field enter the command to execute. To confirm click "Add new Cron job".


Here are several examples of cron jobs retracing the syntax of a UNIX command provided by the terminal. The username has to be replaced by the name of the current user:

  1. php /home/username/public_html/test.php
  2. php5 /home/username/public_html/path/to/cronfile.php
  3. php5 /home/username/public_html/wtcmonitor/cron.php


Once you have created the cron job it will be displayed, as a confirmation of the operation.


Current cron jobs

 

You may have the necessity to add a cron job with specific parameters. Sometimes plugins or modules inside CMS require to set cron with parameters as in the case, for example, of a security token. In this event you have to set the cron as it follows: 

  1. curl --silent --compressed "http://..../index.php?option=..." > /dev/null 2>&1
  2. wget  -q "http://..../index.php?option=..." > /dev/null 2>&1


In command 1, the --silent option will disable any output coming out from the execution of a command: if you need a validation e-mail for the process you have to remove the option. You can receive a notification e-mail anytime a cron is processed. If you need no notification you don't have to type additional text in the boxes and click on "Update".


If you want to remove a cron job, instead, follow two simple steps:

  1. Select the cron job to be canceled
  2. Click "Delete" to remove it for good.
Did you find this answer helpful?

Still need help?

Contacts

Contacts

Request information, assistance or quotes

Chat

Chat

Ask about services and promotions

Ticket

Ticket

Submit a request for technical support

Payments

Payments

Make a payment in a few clicks