You can create a Cron Job in cPanel to automate recurring tasks, such as running scripts, sending scheduled emails, or performing database maintenance. This task is available to all cPanel account users.
Before you begin
You will need:
A cPanel account
The specific command or script path you wish to run
Knowledge of the desired frequency (e.g., hourly, daily, weekly)
Create a Cron Job
Log in to your cPanel account.
Locate the Advanced section and select Cron Jobs.
Under the Add New Cron Job section, enter a descriptive name in the Description field (optional).
Select the desired frequency from the Common Settings dropdown menu, or enter the specific timing in the Minute, Hour, and Day fields.
Enter the full path to the script or the command in the Command field.
Click Add New.
Confirm the result
The new Cron Job will appear in the list of active Cron Jobs.
You will receive a confirmation message that the Cron Job was successfully added.
You can verify the task is running by checking the Next Run time or by checking the output logs if you have configured a log file in your command.
If the Cron Job does not run
Check the command path: Ensure the command includes the full absolute path to the script (e.g.,
/home/username/public_html/script.php).Verify permissions: Ensure the script has the correct execution permissions (typically 755).
Check the timing: Ensure the "Minute," "Hour," and "Day" fields match your intended schedule.
Verify the script: Run the command manually via the cPanel Terminal to see if it produces any errors.
Limitations
Cron Jobs are executed by the server's system cron; if the server is down or the specific service is stopped, the task will not run.
Long-running scripts may be terminated by the server if they exceed the maximum execution time defined in your PHP configuration.
