{"id":2110,"date":"2024-11-01T18:55:31","date_gmt":"2024-11-01T13:25:31","guid":{"rendered":"https:\/\/chennaiwebhosting.in\/blog\/?p=2110"},"modified":"2024-11-01T19:53:17","modified_gmt":"2024-11-01T14:23:17","slug":"how-to-set-up-a-cron-job-in-cpanel","status":"publish","type":"post","link":"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/","title":{"rendered":"How to Set up a Cron Job in cPanel"},"content":{"rendered":"<p>A <strong>cron job<\/strong> is an automated background task scheduled to happen at a specific time. A few examples include checking for updates, backups, or sending out reminder notifications. Cron jobs are important because they automate tasks that reduce manual operations to help with security, performance, and functionality for an administrator and all of the users of the <a href=\"https:\/\/www.chennaiwebhosting.in\/web-hosting-chennai.html\" target=\"_blank\" rel=\"nofollow noopener\">server or website<\/a>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 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\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/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:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#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:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Components_of_a_Cron_Job\" >Components of a Cron Job<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Setting_up_a_Cron_Job_in_cPanel\" >Setting 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-5\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Step_1_Log_in_to_your_cPanel_Account\" >Step 1: Log in to your cPanel Account<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Step_2_Search_for_Cron_Jobs\" >Step 2: Search for Cron Jobs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Step_3_Updating_Cron_Email\" >Step 3: Updating Cron Email<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Step_4_Setting_up_a_Cron_Job\" >Step 4: Setting up a Cron Job<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Cron_Job_Timings\" >Cron Job Timings<\/a><\/li><\/ul><\/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:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Edit_or_Delete_a_Cron_Job\" >Edit or Delete a Cron Job<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/chennaiwebhosting.in\/blog\/how-to-set-up-a-cron-job-in-cpanel\/#Thats_the_Whole_Procedure\" >That\u2019s the Whole Procedure<\/a><\/li><\/ul><\/nav><\/div>\n<h2 id=\"what-is-a-cron-job\" data-role=\"contents-nav-item\"><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<p>A Cron job is a scheduled task that runs automatically at specified intervals on Unix-like operating systems. It\u2019s managed by the Cron daemon, which checks the configuration file (called the &#8220;crontab&#8221;) for tasks to execute.<\/p>\n<p>You can set up a Cron job to run scripts, commands, or programs at regular intervals, such as hourly, daily, weekly, or monthly. The syntax for defining a Cron job typically includes fields for minute, hour, day of the month, month, and day of the week, allowing for precise scheduling.<\/p>\n<h2 id=\"components-of-a-cron-job\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Components_of_a_Cron_Job\"><\/span>Components of a Cron Job<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>A Cron Job needs to have the following components:<\/p>\n<ul>\n<li>The script or task to be executed (the command);<\/li>\n<li>The command to execute the job repeatedly (set in cPanel);<\/li>\n<li>The resulting output\/action of the script (report sent to the email address set by the user);<\/li>\n<\/ul>\n<h2 id=\"prerequisites\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The things you will need before setting up a cron job in cPanel are:<\/p>\n<ul>\n<li>A domain name (www.example.com);<\/li>\n<li>A web hosting account that supports cPanel (<a href=\"https:\/\/www.chennaiwebhosting.in\/\" target=\"_blank\" rel=\"nofollow noopener\">chennaiwebhosting<\/a>);<\/li>\n<li>cPanel username and password.<\/li>\n<\/ul>\n<h2 id=\"setting-up-a-cron-job-in-cpanel\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Setting_up_a_Cron_Job_in_cPanel\"><\/span>Setting up a Cron Job in cPanel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are four steps that you need to follow when setting up a cron job in cPanel.<\/p>\n<h3 id=\"log-in-to-your-cpanel-account\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Step_1_Log_in_to_your_cPanel_Account\"><\/span>Step 1: Log in to your cPanel Account<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To log in to your cPanel Account, if you are a ChennaiWebhosting customer, you need to go to your <strong>Client Area<\/strong>. From there, you click on the Login to cPanel icon:<\/p>\n<p><img decoding=\"async\" class=\"sFlh5c FyHeAf iPVvYb\" src=\"https:\/\/www.a2hosting.com\/images\/uploads\/knowledgebase_images\/kb-cpanel-78-login.png\" alt=\"cPanel login | What is cPanel?\" aria-hidden=\"false\" \/><\/p>\n<h3 id=\"search-for-cron-jobs\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Step_2_Search_for_Cron_Jobs\"><\/span>Step 2: Search for Cron Jobs<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Once you are in the cPanel, you will be able to find <strong>Cron Jobs<\/strong>. You can do that quickly if you type it into the cPanel search bar. Go to the cron job menu by clicking on the link or the icon:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.fastcomet.com\/storage\/upload\/images\/kb\/find-cron-jobs-in-cpanel.png\" alt=\"Find Cron Jobs in cPanel\" \/><\/p>\n<h3 id=\"updating-cron-email\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Step_3_Updating_Cron_Email\"><\/span>Step 3: Updating Cron Email<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If you want to get notified when your cron jobs run, you need to enter your email in the \u201cCron Email\u201d section. This is not a necessary step before you continue, but it\u2019s recommended.<\/p>\n<p>Those email notices would be handy to indicate whenever something goes wrong. For example, if you don\u2019t receive an email after you have subscribed for cron job updates, you will know that something is not quite as planned.<\/p>\n<p>Nevertheless, if you have a lot of cron jobs, such emails could start to irritate you.<\/p>\n<p>To receive an email whenever a cron job runs, <strong>enter your email address<\/strong> in the <strong>Email<\/strong>\u00a0field:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2111\" src=\"https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/crontab.png\" alt=\"crontab\" width=\"965\" height=\"337\" srcset=\"https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/crontab.png 965w, https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/crontab-300x105.png 300w, https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/crontab-768x268.png 768w\" sizes=\"auto, (max-width: 965px) 100vw, 965px\" \/><\/p>\n<p>Note that there could be cases your default email address for the specific <a href=\"https:\/\/cpanel.net\/\" target=\"_blank\" rel=\"nofollow noopener\">cPanel<\/a> account is pre-set to receive the cron job notices. If you no longer wish to receive the notices, click on <strong>Update Email<\/strong>\u00a0without inputting anything in the <strong>Email<\/strong> field.<\/p>\n<h3 id=\"setting-up-a-cron-job\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Step_4_Setting_up_a_Cron_Job\"><\/span>Step 4: Setting up a Cron Job<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To set up your cron job in cPanel, scroll down from the email options, and find the <strong>Add New Cron Job<\/strong> section:<\/p>\n<p>Before you start configuring the individual time and date elements, find and click the <strong>Common Settings<\/strong>\u00a0drop-down:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2112\" src=\"https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/cronset.png\" alt=\"cronset\" width=\"962\" height=\"487\" srcset=\"https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/cronset.png 962w, https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/cronset-300x152.png 300w, https:\/\/chennaiwebhosting.in\/blog\/wp-content\/uploads\/2024\/11\/cronset-768x389.png 768w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/p>\n<h4 id=\"cron-job-timings\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Cron_Job_Timings\"><\/span>Cron Job Timings<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>You will need to follow some steps in regards to the timings of the cron job. You can select your desired cron job interval from the appropriate menus, or you can enter your values:<\/p>\n<ul>\n<li><strong>Common settings<\/strong> \u2014 here, you can select one of the most commonly used intervals. If you choose one option from the drop-down, the system will configure the settings in the Minute, Hour, Day, Month, and Weekday boxes for you:<\/li>\n<li><strong>Minute<\/strong> \u2014 indicates the number of minutes between each cron job or the minute of the hour that you have set for the cron job;<\/li>\n<li><strong>Hour<\/strong> \u2014 indicates the number of hours between jobs, or the hour on the days that you have set for your cron jobs;<\/li>\n<li><strong>Day<\/strong> \u2014 indicates the number of days between cron jobs, or the day of a month, on which you have cron jobs set;<\/li>\n<li><strong>Month<\/strong> \u2014 indicates the number of months between jobs or the month of the year when you want to run the cron job;<\/li>\n<li><strong>Weekday<\/strong> \u2014 sets the weekly schedule when you wish to run the cron job.<\/li>\n<\/ul>\n<p>In the Command text box, you can enter your desired command that you want to run via the cron job.<\/p>\n<h2 id=\"edit-or-delete-a-cron-job\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Edit_or_Delete_a_Cron_Job\"><\/span>Edit or Delete a Cron Job<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Sometimes you might need to edit or delete one or more of your cron jobs. In such cases, you need to:<\/p>\n<ul>\n<li>Scroll down to the <strong>Current Cron Jobs<\/strong> section;<\/li>\n<\/ul>\n<ul>\n<li>Click the <strong>Edit<\/strong> or <strong>Delete<\/strong> link. <strong>Edit<\/strong> will bring up the cron job settings;<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.fastcomet.com\/storage\/upload\/images\/kb\/edit-cron-jobs-in-cpanel.png\" alt=\"Edit Cron Jobs in cPanel\" \/><\/p>\n<ul>\n<li>Make all necessary changes and then click the <strong>Edit Line<\/strong> button:<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.fastcomet.com\/storage\/upload\/images\/kb\/edit-line-for-cron-jobs.png\" alt=\"Edit Line for Cron Jobs\" \/><\/p>\n<ul>\n<li><strong>Delete<\/strong> opens a delete dialog. Click the <strong>Delete<\/strong>\u00a0button:<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.fastcomet.com\/storage\/upload\/images\/kb\/delete-cron-job-cpanel.png\" alt=\"Delete Cron Job in cPanel\" \/><\/p>\n<h2 id=\"thats-the-whole-procedure\" data-role=\"contents-nav-item\"><span class=\"ez-toc-section\" id=\"Thats_the_Whole_Procedure\"><\/span>That\u2019s the Whole Procedure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You might have been surprised, but as you can see, setting up cron jobs via cPanel is quite a straightforward process. If you find that cron jobs are useful to you, you should start thinking about other uses for them.<\/p>\n<p>However, in case anything goes wrong after setting a cron job, and you don\u2019t know what to do\u2014<a href=\"https:\/\/www.chennaiwebhosting.in\/contact-chennai-hosting.html\" target=\"_blank\" rel=\"nofollow noopener\">contact our 24\/7 technical support team<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A cron job is an automated background task scheduled to happen at a specific time. A few examples include checking for updates, backups, or sending out reminder notifications. Cron jobs are important because they automate tasks that reduce manual operations to help with security, performance, and functionality for an administrator and all of the users [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2110","post","type-post","status-publish","format-standard","hentry","category-home"],"_links":{"self":[{"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/2110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=2110"}],"version-history":[{"count":5,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/2110\/revisions"}],"predecessor-version":[{"id":2117,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/2110\/revisions\/2117"}],"wp:attachment":[{"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=2110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=2110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chennaiwebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=2110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}