Cron Jobs / Automated Tasks

Introduction and overview

Cron jobs are commands used to schedule tasks that must run periodically, for instance: from Monday to Friday at 3PM. These jobs allow you to automate some commands and scripts on your server, to automatically run repetitive tasks. For instance, you could create a cron job to send emails every X days. This is a system process that runs in the background.

Use

Cron jobs can be controlled via the cPanel.

  1. Connect to your cPanel and click on Advanced Tools > Cron Jobs.
  2. Click on Standard or Advanced, depending on your level of experience (Standard is recommended).
  3. Specify the command to run, its schedule, and click on Add New Cron Job.

Examples

To run a PHP script called script.php located in your /public_html/ folder, you can use the following Cron command: /usr/local/bin/php -q /home/[username]/public_html/script.php > /dev/null

  • Replace /home/[username]/public_html/script.php by the path to your script
  • By default, the cron job sends a confirmation of successful execution after each run. By adding > /dev/null at the end of the command, you specify to the task that it should not send you an email.

 

  • 0 gebruikers vonden dit artikel nuttig
Was dit antwoord nuttig?

Gerelateerde artikelen

[ADVANCED] How to Group Two Separate Accounts into One Account with an Addon Domain

The procedure to transfer an independant hosting account into an existing hosting account, as an...

Addon Domains and Aliases

What are aliases and addon domains? An alias is a special domain name configuration that will...

Help, I Can't Connect to the cPanel!

Here are different reasons and solutions to resolve problems connecting to your CPanel. If you...

How can I Create an Addon Domain (or Additional Website)

What is an addon domain or an additional website? An addon domain (or additional website) is a...

How to Change your cPanel Password

You may change your cPanel password from your Client Area. Log in to the WHC Client Area,...

Powered by WHMCompleteSolution