How to set up a cron job (scheduled task)

A cron job runs a task on a schedule, for example a script that runs every night. Some applications ask you to add one. You do not need this unless you have been told to.

Steps

If your cPanel uses the Jupiter theme

  1. Get the exact command from the application's instructions. Do not guess.
  2. Log in to cPanel and open Advanced > Cron Jobs.
  3. Optionally, enter an email address under Cron Email to be told when a job runs.
  4. Under Add New Cron Job, choose how often it should run from Common Settings, such as Once Per Day. The boxes for Minute, Hour, Day, Month, and Weekday fill in automatically.
  5. Paste the command into the Command box.
  6. Click Add New Cron Job.

If your cPanel uses the Meridian theme

  1. Get the exact command from the application's instructions. Do not guess.
  2. Log in to cPanel.
  3. cPanel's official Meridian guides do not document Cron Jobs in the hubs. Click Search... in the header, or press Ctrl+K (Cmd+K on a Mac), and search for Cron Jobs. Open the matching result. If it does not appear, contact Barrett IT Support.
  4. If the tool opens, you can optionally enter an email address to be told when a job runs.
  5. Choose how often it should run from Common Settings, such as Once Per Day, paste the command into the Command box, and add the job.
  6. If you cannot find Cron Jobs, contact Barrett IT Support and send us the command and the schedule you need.

What cron jobs are used for

Many applications use scheduled tasks to send reminders, clear caches, import data, or run backups. WordPress has its own schedule, which is triggered by visitors, and a few advanced users replace it with a cron job for reliability. Unless an application's instructions specifically ask for one, you do not need to add any cron jobs yourself.

Tips and troubleshooting

  • Use the full path to files, for example /home/youraccount/public_html/script.php. Ask the application's author or support for the right path.
  • Do not run jobs more often than they need to. Jobs that overlap can slow your site.
  • Cron email notifications can fill your inbox. Remove the address under Cron Email to turn them off.
  • Be extremely careful with any command that deletes files. A mistake can erase your website.
  • To change a job, click Edit. To remove it, click Delete.
  • If a job does not work, check the command by hand and the file permissions, or contact support.

Need help? Contact Barrett IT Support at support@barrettit.com or call 888.374.4632.

  • 0 Пользователи нашли это полезным
Помог ли вам данный ответ?

Связанные статьи

How to change your PHP version

PHP is the programming language many websites, including WordPress, run on. Older PHP versions...