{"id":15725,"date":"2026-06-16T19:24:26","date_gmt":"2026-06-16T18:24:26","guid":{"rendered":"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/"},"modified":"2026-11-02T14:31:06","modified_gmt":"2026-11-02T13:31:06","slug":"how-to-set-up-cron-jobs-on-your-hosting-account","status":"publish","type":"post","link":"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/","title":{"rendered":"How to Set Up Cron Jobs on Your Hosting Account"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_87 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#What_is_a_cron_job\" >What is a cron job?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Understand_cron_schedule_syntax\" >Understand cron schedule syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#How_to_set_up_a_cron_job_in_cPanel\" >How to set up a cron job in cPanel<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#1_Sign_in_to_cPanel\" >1. Sign in to cPanel<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#2_Open_Cron_Jobs\" >2. Open Cron Jobs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#3_Configure_email_notifications\" >3. Configure email notifications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#4_Choose_the_schedule\" >4. Choose the schedule<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#5_Enter_the_full_command\" >5. Enter the full command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#6_Save_and_test_the_job\" >6. Save and test the job<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#How_to_create_cron_jobs_using_SSH\" >How to create cron jobs using SSH<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#1_Connect_to_your_hosting_account\" >1. Connect to your hosting account<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#2_Open_your_users_crontab\" >2. Open your user&#8217;s crontab<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#3_Add_a_scheduled_PHP_script\" >3. Add a scheduled PHP script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#4_Check_and_remove_entries_carefully\" >4. Check and remove entries carefully<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#How_to_run_PHP_scripts_reliably\" >How to run PHP scripts reliably<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Using_cron_jobs_with_WordPress\" >Using cron jobs with WordPress<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Common_cron_job_problems_and_how_to_fix_them\" >Common cron job problems and how to fix them<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#The_cron_job_does_not_run\" >The cron job does not run<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#The_command_works_in_SSH_but_fails_in_cron\" >The command works in SSH but fails in cron<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#PHP_version_or_executable_path_is_incorrect\" >PHP version or executable path is incorrect<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Permission_denied_errors\" >Permission denied errors<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#The_job_runs_at_the_wrong_time\" >The job runs at the wrong time<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#The_job_runs_more_than_once_or_overlaps\" >The job runs more than once or overlaps<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#There_is_no_useful_output_to_diagnose_the_failure\" >There is no useful output to diagnose the failure<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Best_practices_for_managing_cron_jobs\" >Best practices for managing cron jobs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Frequently_asked_questions\" >Frequently asked questions<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Do_I_need_SSH_to_create_a_cron_job\" >Do I need SSH to create a cron job?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Can_I_run_a_PHP_script_with_a_cron_job\" >Can I run a PHP script with a cron job?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#How_often_can_a_cron_job_run\" >How often can a cron job run?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#What_is_the_difference_between_cron_and_WP-Cron\" >What is the difference between cron and WP-Cron?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Why_should_I_use_absolute_paths_in_cron_commands\" >Why should I use absolute paths in cron commands?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/da-manager.com\/blog\/how-to-set-up-cron-jobs-on-your-hosting-account\/#Further_reading_and_official_documentation\" >Further reading and official documentation<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\">Cron jobs let you automate recurring tasks on your hosting account, from running PHP scripts and generating reports to clearing temporary files and carrying out scheduled maintenance. Instead of remembering to run a task manually, you define when it should run and the server executes it at the specified time.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to create cron jobs in cPanel and through SSH, how to read the five-field cron schedule, and how to run PHP and WordPress tasks reliably. It also covers common problems such as incorrect file paths, permissions, time zones, missing environment variables and overlapping jobs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_cron_job\"><\/span>What is a cron job?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">A cron job is a scheduled command that runs automatically on a Unix-like server. The cron service checks a schedule and launches the command when its date and time fields match. Cron is commonly used for backups, data imports, report generation, maintenance scripts and other repeatable server tasks.<\/p>\n\n\n<p class=\"wp-block-paragraph\">A cron job normally runs under the account that owns the crontab entry. This matters because that account determines which files, folders and commands the task can access. Only schedule commands you understand and have permission to run.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Understand_cron_schedule_syntax\"><\/span>Understand cron schedule syntax<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">A standard crontab entry contains five time fields followed by the command to execute:<\/p>\n\n\n<pre class=\"wp-block-preformatted\">* * * * * command-to-run\n| | | | |\n| | | | +--- Day of the week (0-7, Sunday is 0 or 7)\n| | | +----- Month (1-12)\n| | +------- Day of the month (1-31)\n| +--------- Hour (0-23)\n+----------- Minute (0-59)<\/pre>\n\n\n<p class=\"wp-block-paragraph\">Each field accepts numbers and scheduling operators. An asterisk means every permitted value, a comma separates specific values, a hyphen defines a range, and a slash sets an interval. For example, <code>*\/15<\/code> in the minute field means every 15 minutes.<\/p>\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Schedule<\/th><th>Meaning<\/th><\/tr><\/thead><tbody>\n<tr><td><code>0 0 * * *<\/code><\/td><td>Every day at midnight<\/td><\/tr>\n<tr><td><code>*\/15 * * * *<\/code><\/td><td>Every 15 minutes<\/td><\/tr>\n<tr><td><code>0 9 * * 1<\/code><\/td><td>Every Monday at 09:00<\/td><\/tr>\n<tr><td><code>30 2 * * *<\/code><\/td><td>Every day at 02:30<\/td><\/tr>\n<tr><td><code>0 0 1 * *<\/code><\/td><td>At midnight on the first day of each month<\/td><\/tr>\n<tr><td><code>0 8,16 * * 1-5<\/code><\/td><td>At 08:00 and 16:00, Monday to Friday<\/td><\/tr>\n<\/tbody><\/table><\/figure>\n\n\n<p class=\"wp-block-paragraph\">Be careful when combining the day-of-month and day-of-week fields. On common cron implementations, when both are restricted (not set to an asterisk), a job can run when either field matches. Check your server&#8217;s cron documentation if a schedule depends on this distinction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_set_up_a_cron_job_in_cPanel\"><\/span>How to set up a cron job in cPanel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">cPanel provides a graphical Cron Jobs interface, which is convenient if you do not want to edit a crontab over SSH. The exact layout can vary slightly by cPanel version and hosting provider.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Sign_in_to_cPanel\"><\/span>1. Sign in to cPanel<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Open cPanel from your hosting client area. Some providers also allow access through a URL such as <code>https:\/\/yourdomain.com:2083<\/code>, although the client-area link is usually the safest route.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Open_Cron_Jobs\"><\/span>2. Open Cron Jobs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Find the <strong>Advanced<\/strong> section and select <strong>Cron Jobs<\/strong>. If you cannot see the option, your hosting plan or account permissions may not include cron management. Contact your hosting provider to confirm availability.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Configure_email_notifications\"><\/span>3. Configure email notifications<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">cPanel may offer an email address for cron output. When a command writes output, cPanel can send that output to the configured address. This is useful while testing, but a frequent task can generate a large volume of messages. You can redirect output to a log file instead, or suppress output once you are confident the job is working.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Choose_the_schedule\"><\/span>4. Choose the schedule<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Choose a common interval from the dropdowns or enter the minute, hour, day, month and weekday values yourself. For example, to run a task every day at 02:30, use <code>30<\/code>, <code>2<\/code>, <code>*<\/code>, <code>*<\/code> and <code>*<\/code> in the five fields.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Enter_the_full_command\"><\/span>5. Enter the full command<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">In the command field, enter the interpreter and the absolute path to the script. A PHP example might look like this:<\/p>\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/local\/bin\/php \/home\/username\/public_html\/cron\/backup.php<\/pre>\n\n\n<p class=\"wp-block-paragraph\">The PHP executable path differs between servers. Common locations include <code>\/usr\/bin\/php<\/code> and <code>\/usr\/local\/bin\/php<\/code>, but do not assume either is correct. Check your hosting documentation, cPanel&#8217;s PHP information or ask your provider for the CLI PHP path and version.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Save_and_test_the_job\"><\/span>6. Save and test the job<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Select the option to add the cron job, then confirm that it appears in the current jobs list with the schedule and command you intended. If possible, choose a schedule a few minutes ahead while testing, then inspect its output or log. Once confirmed, change it to the intended production schedule.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Need a cPanel-based hosting environment?<\/strong> DaManager Shared Hosting includes a cPanel-powered hosting environment for managing common website and account tasks.<\/p>\n\n\n<div class=\"da-manager-product-preview\" style=\"display:flex;gap:16px;align-items:center;border:1px solid #e5e7eb;border-radius:10px;padding:14px;margin:20px 0;\">\n  <a href=\"https:\/\/da-manager.com\/shared-hosting\/\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/da-manager.com\/blog\/wp-content\/uploads\/2026\/05\/Da-Manager-Shared-Hosting-1-1.png\" alt=\"DaManager Shared Hosting\" style=\"width:140px;height:auto;border-radius:6px;\" \/><\/a>\n  <div><strong>DaManager Shared Hosting<\/strong><p>Explore cPanel-powered shared hosting for websites and everyday hosting management.<\/p><a href=\"https:\/\/da-manager.com\/shared-hosting\/\" target=\"_blank\" rel=\"noopener\">View Shared Hosting plans<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_create_cron_jobs_using_SSH\"><\/span>How to create cron jobs using SSH<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">If your hosting plan provides SSH access, you can manage cron jobs from the command line. This method is common on VPS and dedicated servers, and may also be available on shared hosting accounts.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Connect_to_your_hosting_account\"><\/span>1. Connect to your hosting account<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Connect using your SSH client and the host, port and username supplied by your provider. If you need help connecting, see our guide on <a href=\"https:\/\/da-manager.com\/blog\/how-to-use-ssh-to-manage-your-hosting-server\/\">how to use SSH to manage your hosting server<\/a>.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Open_your_users_crontab\"><\/span>2. Open your user&#8217;s crontab<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-preformatted\">crontab -e<\/pre>\n\n\n<p class=\"wp-block-paragraph\">This opens the crontab for the current user in the configured text editor. Add one scheduled command per line. Save and exit the editor to install the updated crontab. Use <code>crontab -l<\/code> to list the current user&#8217;s entries.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Add_a_scheduled_PHP_script\"><\/span>3. Add a scheduled PHP script<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-preformatted\">30 2 * * * \/usr\/bin\/php \/home\/username\/scripts\/report.php<\/pre>\n\n\n<p class=\"wp-block-paragraph\">This example runs a PHP report script every day at 02:30. Replace the PHP executable and script paths with the actual paths on your server. You can check the PHP CLI version with <code>php -v<\/code> and, where permitted, locate the executable with <code>command -v php<\/code>.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Check_and_remove_entries_carefully\"><\/span>4. Check and remove entries carefully<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<pre class=\"wp-block-preformatted\">crontab -l\ncrontab -e<\/pre>\n\n\n<p class=\"wp-block-paragraph\">Review the list before editing. Avoid replacing the entire crontab with a partial file unless you have backed up the existing entries. A useful precaution is to save a copy of the current schedule before making significant changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_run_PHP_scripts_reliably\"><\/span>How to run PHP scripts reliably<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">Scripts launched by cron do not necessarily inherit the same working directory, shell configuration or environment variables as an interactive SSH session. Use absolute paths for the PHP executable, script, input files and output files. If the script relies on environment variables, define the required values explicitly in the command or in a protected configuration file.<\/p>\n\n\n<p class=\"wp-block-paragraph\">For example, redirect standard output and errors to a log file while testing:<\/p>\n\n\n<pre class=\"wp-block-preformatted\">30 2 * * * \/usr\/bin\/php \/home\/username\/scripts\/report.php >> \/home\/username\/logs\/report.log 2>&1<\/pre>\n\n\n<p class=\"wp-block-paragraph\">Make sure the account running the cron job can write to the log directory. Protect log files if they contain personal data, credentials or other sensitive information, and rotate or clear them periodically so they do not consume all available disk space.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_cron_jobs_with_WordPress\"><\/span>Using cron jobs with WordPress<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<p class=\"wp-block-paragraph\">WordPress includes a scheduling system called WP-Cron. It is used for tasks such as publishing scheduled posts, checking for updates and running scheduled plugin actions. Unlike a system cron service, WP-Cron is normally triggered by site requests. If a site receives little traffic, a scheduled task may run later than expected because no request has triggered the scheduler.<\/p>\n\n\n<p class=\"wp-block-paragraph\">For sites that need more predictable scheduling, an administrator may configure the server&#8217;s cron service to call WordPress&#8217;s <code>wp-cron.php<\/code> endpoint at a regular interval. This should be planned carefully: after confirming the system task is working, WordPress&#8217;s page-load trigger can be disabled by defining the following constant in <code>wp-config.php<\/code>:<\/p>\n\n\n<pre class=\"wp-block-preformatted\">define('DISABLE_WP_CRON', true);<\/pre>\n\n\n<p class=\"wp-block-paragraph\">Then configure a system cron job to request the site&#8217;s cron endpoint. For example, using a command-line HTTP client:<\/p>\n\n\n<pre class=\"wp-block-preformatted\">*\/5 * * * * curl -fsS https:\/\/example.com\/wp-cron.php?doing_wp_cron >\/dev\/null 2>&1<\/pre>\n\n\n<p class=\"wp-block-paragraph\">Replace the domain with your site&#8217;s canonical HTTPS address and confirm that the command-line HTTP client is available. Some hosting environments recommend a PHP-based method or a different command. Do not disable the normal WP-Cron trigger until the replacement schedule is in place and tested, or scheduled WordPress tasks may stop running.<\/p>\n\n\n<p class=\"wp-block-paragraph\">Administrators with WP-CLI access can inspect scheduled events using <code>wp cron event list<\/code> and test the cron system with <code>wp cron test<\/code>. These commands help identify overdue events and configuration problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Common_cron_job_problems_and_how_to_fix_them\"><\/span>Common cron job problems and how to fix them<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_cron_job_does_not_run\"><\/span>The cron job does not run<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Check that the entry was saved, the schedule is valid and the hosting plan permits cron execution. Confirm that the cron service is available and that the command works when run manually under the same account. On managed or shared hosting, ask the provider whether execution limits or account restrictions apply.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_command_works_in_SSH_but_fails_in_cron\"><\/span>The command works in SSH but fails in cron<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">This often happens because cron uses a limited environment. Specify the full path to executables and files, set any required environment variables, and set the working directory explicitly if the script expects one. Do not rely on aliases or shell startup files that may not be loaded for scheduled commands.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PHP_version_or_executable_path_is_incorrect\"><\/span>PHP version or executable path is incorrect<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">The PHP version used by the command line can differ from the version assigned to the website. Confirm the correct CLI binary with your host and test it using <code>\/path\/to\/php -v<\/code>. If the script requires a particular PHP version or extension, check that the CLI configuration provides it.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Permission_denied_errors\"><\/span>Permission denied errors<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Check that the cron user&#8217;s account has permission to execute the script and read its dependencies, and write to any output or log directories. Avoid making files world-writable as a quick fix. Correct ownership and the minimum permissions needed are safer.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_job_runs_at_the_wrong_time\"><\/span>The job runs at the wrong time<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Check the server&#8217;s time zone and the time zone used by the hosting control panel. Cron commonly uses the server&#8217;s configured time zone, which may differ from your local time or the time zone configured in WordPress. Confirm the actual server time with your provider before changing the schedule.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_job_runs_more_than_once_or_overlaps\"><\/span>The job runs more than once or overlaps<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">If a task takes longer than its interval, another instance may start before the previous one finishes. This can duplicate work or put unnecessary load on the server. Reduce the frequency, optimise the script or use a locking mechanism appropriate for your environment. Also check that the same task has not been configured in both cPanel and a user&#8217;s crontab.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"There_is_no_useful_output_to_diagnose_the_failure\"><\/span>There is no useful output to diagnose the failure<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Temporarily redirect standard output and errors to a protected log file. Review the application&#8217;s own logs as well as hosting error logs. Our guides to <a href=\"https:\/\/da-manager.com\/blog\/how-to-use-error-logs-in-cpanel-to-troubleshoot\/\">using error logs in cPanel<\/a> and <a href=\"https:\/\/da-manager.com\/blog\/how-to-monitor-your-server-resources-in-cpanel\/\">monitoring server resources in cPanel<\/a> can help you investigate related problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Best_practices_for_managing_cron_jobs\"><\/span>Best practices for managing cron jobs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<ul class=\"wp-block-list\">\n<li>Test each command manually before scheduling it.<\/li>\n<li>Use absolute paths for executables, scripts, files and logs.<\/li>\n<li>Run jobs with an account that has only the permissions required.<\/li>\n<li>Schedule resource-intensive tasks outside your website&#8217;s busiest periods where practical.<\/li>\n<li>Log useful output while testing, then manage log size and retention.<\/li>\n<li>Prevent duplicate and overlapping runs where a task is not safe to run concurrently.<\/li>\n<li>Review cron entries periodically and remove obsolete schedules.<\/li>\n<li>Keep scripts, credentials and configuration files protected.<\/li>\n<li>Monitor the server if scheduled tasks consume significant CPU, memory or disk I\/O.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Frequently_asked_questions\"><\/span>Frequently asked questions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Do_I_need_SSH_to_create_a_cron_job\"><\/span>Do I need SSH to create a cron job?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">No. If your hosting account provides cPanel Cron Jobs, you can create and manage scheduled tasks through the control panel. SSH is an alternative for users who prefer command-line administration or need more control.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Can_I_run_a_PHP_script_with_a_cron_job\"><\/span>Can I run a PHP script with a cron job?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Yes. Use the correct PHP command-line executable followed by the absolute path to your PHP script. Confirm the CLI PHP version and permissions with your hosting provider if the script fails.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_often_can_a_cron_job_run\"><\/span>How often can a cron job run?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Standard cron syntax can schedule jobs as frequently as once per minute. Your hosting provider may impose minimum intervals, execution time limits or resource restrictions, so check your plan before scheduling frequent tasks.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_the_difference_between_cron_and_WP-Cron\"><\/span>What is the difference between cron and WP-Cron?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">System cron is a server-level scheduler that runs according to the server&#8217;s clock. WP-Cron is WordPress&#8217;s application-level scheduler and is normally triggered by site traffic. A system cron can be used to trigger WP-Cron more predictably, but it must be configured and tested correctly.<\/p>\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_should_I_use_absolute_paths_in_cron_commands\"><\/span>Why should I use absolute paths in cron commands?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n<p class=\"wp-block-paragraph\">Cron jobs often run with a smaller environment and a different working directory from an interactive shell. Absolute paths remove ambiguity about which executable and files the command should use.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Further_reading_and_official_documentation\"><\/span>Further reading and official documentation<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.cpanel.net\/cpanel\/advanced\/cron-jobs\/\" target=\"_blank\" rel=\"noopener\">cPanel: Cron Jobs documentation<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/plugins\/cron\/\" target=\"_blank\" rel=\"noopener\">WordPress Developer Resources: Cron<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/plugins\/cron\/hooking-wp-cron-into-the-system-task-scheduler\/\" target=\"_blank\" rel=\"noopener\">WordPress: Hooking WP-Cron into the system task scheduler<\/a><\/li>\n<li><a href=\"https:\/\/man7.org\/linux\/man-pages\/man5\/crontab.5.html\" target=\"_blank\" rel=\"noopener\">Linux manual: crontab(5)<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Setting up cron jobs is a straightforward way to automate routine work on a hosting account, provided that each command is tested, scheduled sensibly and monitored. Start with a simple task, confirm that it runs as expected, and then add more automation as your requirements grow.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to create cron jobs using cPanel or SSH, understand scheduling syntax, automate PHP and WordPress tasks, and troubleshoot common cron job errors.<\/p>\n","protected":false},"author":16,"featured_media":16410,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mbp_gutenberg_autopost":false,"footnotes":""},"categories":[147,219],"tags":[333,4039,220,315,161],"class_list":["post-15725","post","type-post","status-publish","format-standard","has-post-thumbnail","category-general","category-hosting","tag-cpanel","tag-cron-jobs","tag-hosting","tag-shared-hosting","tag-wordpress"],"jetpack_featured_media_url":"https:\/\/da-manager.com\/blog\/wp-content\/uploads\/2026\/06\/how-to-set-up-cron-jobs-da-manager.png","_links":{"self":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts\/15725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/comments?post=15725"}],"version-history":[{"count":2,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts\/15725\/revisions"}],"predecessor-version":[{"id":16409,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/posts\/15725\/revisions\/16409"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/media\/16410"}],"wp:attachment":[{"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/media?parent=15725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/categories?post=15725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/da-manager.com\/blog\/wp-json\/wp\/v2\/tags?post=15725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}