Creating a scheduled cron task in cPanel

Cron runs a command on a schedule without a browser visit. Applications use it for queues, scheduled emails, cleanup and billing jobs. The command runs as the hosting account and needs the correct executable, paths and permissions.

Check access and requirements

Use the command recommended by the application and confirm the server’s scheduling time zone. Test it manually through an authorised terminal where possible. Choose a frequency longer than the normal runtime or use the application’s supported locking mechanism to avoid overlapping jobs.

01 Create a scheduled cron task in cPanel

  1. Open Cron Jobs and set a monitored Cron Email address while you are testing.
  2. Under Add New Cron Job, choose an appropriate common schedule or enter the minute, hour, day, month and weekday fields deliberately. Check the resulting expression before saving.
  3. Enter the full command, including the correct PHP or other interpreter path and the script’s absolute path. A website’s PHP version does not necessarily select the same command-line PHP binary.
  4. Add the task once and wait for its scheduled run. Inspect the application’s task log and any output email before increasing its frequency.

02 Example: schedule a harmless check before a production cron task

In cPanel Cron Jobs, a schedule of minute 15 and hour */6 means 00:15, 06:15, 12:15 and 18:15 in the server's scheduling timezone. This sample writes only a timestamp, using an existing private directory outside the website document root.

Code or configuration example
15 */6 * * * /usr/bin/date -Is >> /home/CPANEL_USER/private/cron-check.log 2>&1

Read the result: Replace CPANEL_USER and confirm the private directory exists. In cPanel's form, enter the first five fields in the schedule controls and only the remaining command in Command. A new timestamp after the scheduled time confirms this harmless command ran under the account.

Remove the diagnostic entry after the test and use the application's documented command for the real task. A timestamp proves scheduler execution, not application success. Keep a suitable application log and avoid running a mail, billing or payment job twice through duplicate schedulers.

03 Example: schedule a task once per hour

If the application calls for an hourly task, the schedule 0 * * * * runs it at minute zero of each hour in the server scheduling time zone. Enter the schedule fields separately from the command.

Field Value
Minute 0
Hour *
Day *
Month *
Weekday *

Use the application-approved absolute command in the Command field. After saving, inspect the first expected run and its recorded outcome. Hourly is only an example: use the application-required frequency and ensure one run can finish before the next begins.

Confirm the expected result

Confirm the intended work happened once and that no second scheduler is performing the same job. For example, check the queue’s processed items or the application’s recorded last-run time.

Why does my scheduled command fail even though the website works?

A path error, missing extension or wrong working directory can cause a command that works in a browser to fail in cron. Keep useful error output during diagnosis; do not immediately append a blanket output-discard redirection. Share a redacted command and exact error with support.

Sources and further reading

  • 0 Users Found This Useful
  • cpanel-whm, development
Was this answer helpful?

Related Articles

Changing or recovering your cPanel password

Your cPanel password controls access to the hosting account and may also be used by its main...

Changing your cPanel interface theme and finding familiar tools

A cPanel theme changes how management tools are presented. It does not change your public...

Checking disk space and traffic usage in cPanel

Disk usage is stored data; bandwidth is data transferred. A large folder consumes disk space...

Choosing where cPanel cron output is emailed

Cron output emails are useful when a scheduled command reports a failure or diagnostic message....

Updating cPanel contact details and account alerts

cPanel contact settings determine where hosting alerts and password-reset notices are sent....