{"id":213,"date":"2021-01-16T19:05:55","date_gmt":"2021-01-17T03:05:55","guid":{"rendered":"http:\/\/www.spiffynasty\/?p=213"},"modified":"2021-01-16T19:55:48","modified_gmt":"2021-01-17T03:55:48","slug":"cronjob","status":"publish","type":"post","link":"https:\/\/spiffynasty.com\/blahblahblah\/cronjob\/","title":{"rendered":"CronJob"},"content":{"rendered":"<div class=\"su-tabs su-tabs-style-default su-tabs-mobile-stack\" data-active=\"1\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-tabs-nav\"><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">bluehost | info article<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">more wp-cron<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">nas - email \/ cron<\/span><span class=\"\" data-url=\"\" data-target=\"blank\" tabindex=\"0\" role=\"button\">tab<\/span><\/div><div class=\"su-tabs-panes\"><div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"bluehost | info article\">\n<div class=\"display: inline-block; background: #cccccc; padding: 10px;\">\nhttps:\/\/www.jabcreations.com\/blog\/basic-php-cron-job-example<\/p>\n<h5>cron job attempts<\/h5>\n[code]\nwget -q -O &#8211; https:\/\/clickety-clack.click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n<figure id=\"attachment_126121\" aria-describedby=\"caption-attachment-126121\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-214\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm.png\" width=\"1280\" height=\"687\" alt=\"Screen Shot 2021 01 15 At 11.21.49 Pm\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm.png 1280w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-800x429.png 800w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-300x161.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-768x412.png 768w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-600x322.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-1250x671.png 1250w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/screen-shot-2021-01-15-at-11.21.49-pm-400x215.png 400w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><figcaption id=\"caption-attachment-126121\" class=\"wp-caption-text\">Screen Shot 2021 01 15 At 11.21.49 Pm<\/figcaption><\/figure>\n[code]\n\/usr\/local\/bin\/ea-php74 \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron<br \/>\n[\/code]\n<\/p>\n[code]\nwget -q -O &#8211; \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n[code]\nwget -q -O &#8211; https:\/\/clickety-clack.click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n&#8211; or &#8211;<br \/>\nwget -q -O &#8211; https:\/\/clickety-clack.click\/wp-cron.php?doing_wp_cron<br \/>\n(does it send email?)<br \/>\n&lt;br&gt;&lt;br&gt;&lt;\/p&gt;<\/p>\n<p>&lt;\/div&gt;<\/p>\n<p>&lt;p&gt;command:&lt;br&gt;<br \/>\n[code]\nwget -q -O &#8211; https:\/\/clickety-clack.click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n<p>by path &#8211;<\/p>\n[code]\nwget -q -O &#8211; \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n<div class=\"clsWrap\">\n<div class=\"clsWrapPad\">\n<div class=\"cls50padR\">\nblock report by email<br \/>\n[code]\nwget -q -O &#8211; \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n<br \/>\ncronjobreporting@shawneee.com<\/p>\n[code]\nwget -q -O &#8211; \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1<br \/>\n[\/code]\n[code]\nwget -q -O &#8211; \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron \/\/<br \/>\nmail -e -s &quot;task #1 report&quot; postmaster@example.com<br \/>\n[\/code]\n<\/p>\n<hr class=\"hrstyle1\"><\/p>\n<p>\/usr\/local\/bin\/php \/home3\/shawnef8\/public_html\/clickety-clack-click\/wp-cron.php?doing_wp_cron<\/p>\n<\/div>\n<div class=\"cls50padR\">\n<strong> >\/dev\/null 2>&#038;1<\/strong><\/p>\n<p>> is for redirect<\/p>\n<p>\/dev\/null is a black hole where any data sent, will be discarded<\/p>\n<p>2 is the file descriptor for Standard Error<\/p>\n<p>> is for redirect<\/p>\n<p>&#038; is the symbol for file descriptor (without it, the following 1 would be considered a filename)<\/p>\n<p>1 is the file descriptor for Standard Out<\/p>\n<p>Therefore >\/dev\/null 2>&#038;1 redirects the output of your program to \/dev\/null. Include both the Standard Error and Standard Out.<\/p>\n<p>Much more information is available at The Linux Documentation Project&#8217;s I\/O Redirection page.<\/p>\n<p>cron will only email you if there is some output from you job. With everything redirected to null, there is no output and hence cron will not email you.\n<\/div>\n<\/div>\n<\/div>\n<hr class=\"hrstyle6\">\n<div class=\"clsWrap\">\n<div class=\"clsWrapPad\">\n<div class=\"cls40padR\">\nSimiliar c-Panel to bluehost<br \/>\n<a href=\"https:\/\/www.hostpapa.com\/knowledgebase\/replace-wordpress-cron-real-cronjob\/\" target\"_blank\">replace-wordpress-cron-real-cronjob<\/a><br \/>\nUnder Add New Cron Job, enter the following line in the command field:<\/p>\n[code]\n\/usr\/local\/bin\/php \/home\/user\/public_html\/wp-cron.php<br \/>\n[\/code]\n<p>Replace \/home\/user\/public_html\/wp-cron.php with the actual path to your wp-cron.php file. Head back to cPanel File Manager if you need to check the path.<br \/>\n<\/p>\n<\/div>\n<div class=\"cls60padR\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-215\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/4-6-800x757-1.png\" width=\"800\" height=\"757\" alt=\"4 6\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/4-6-800x757-1.png 800w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/4-6-800x757-1-300x284.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/4-6-800x757-1-768x727.png 768w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/4-6-800x757-1-600x568.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/4-6-800x757-1-400x379.png 400w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<hr class=\"hrstyle3\">\n<div class=\"clsWrap\">\n<div class=\"clsWrapPad\">\n<div class=\"cls40padR\">\n<h4>Bluehost info<\/h4>\n<ul>\n<li><a href=\"\/help\/article\/cron-job-basics\" target=\"_blank\" rel=\"noopener\">Cron Job Basics<\/a><\/li>\n<li><a href=\"https:\/\/www.bluehost.com\/help\/article\/setup-remove-or-edit-a-cron-job\" target=\"_blank\" rel=\"noopener\">>Setup, Remove, or Edit a Cron Job<\/a><\/li>\n<li><a href=\"\/help\/article\/cron-time\" target=\"_blank\" rel=\"noopener\">Crons Running at Specific Date and Time<\/a><\/li>\n<li><a href=\"\/help\/article\/specify-a-cron-job-to-use-a-specific-phpini-file\" target=\"_blank\" rel=\"noopener\">Specify a Cron Job to use a Specific php.ini File<\/a><\/li>\n<li><a href=\"\/help\/article\/cron-jobs-with-php-and-other-file-types\" target=\"_blank\" rel=\"noopener\">Cron Jobs with PHP and other File Types<\/a><\/li>\n<\/ul>\n<\/div>\n<div class=\"cls60padR\">\n<blockquote><p>\n<strong>PHP command examples:<\/strong><\/p>\n<p>General example:<br \/>\n\/usr\/local\/bin\/php \/home3\/shawnef8\/public_html\/path\/to\/cron\/script<\/p>\n<p>Domain-specific example:<br \/>\n\/usr\/local\/bin\/ea-php99 \/home3\/shawnef8\/domain_path\/path\/to\/cron\/script<br \/>\nIn the above example, replace \u201cea-php99\u201d with the PHP version assigned to the domain you wish to use. Look in the MultiPHP Manager for the actual PHP version assigned to a domain.<br \/>\n<br \/><strong>ea-php74<\/strong>\n<\/p><\/blockquote>\n<p><strong>Shared<\/strong><br \/>\nYou MAY NOT run a Cron Job more often than every 15 minutes.<\/p>\n<p>If you are getting errors when using the GET command, please contact us and request access.<\/p>\n<ul>\n<li>The initial working directory for the process is your home directory.<\/li>\n<li>Because the processes are run in a non-interactive shell, .bashrc and other startup files are not read.<\/li>\n<li>Only \/usr\/bin and \/bin will be checked for the specified executable. Executables in other directories must be specified as absolute paths, such as \/ramdisk\/bin\/php5 or relative paths, such as .\/my_program.<\/li>\n<li>When running a script, the interpreter must be specified either in a valid #! line using a full path or at the command line.<\/li>\n<li>File arguments must be specified with absolute paths, or paths relative to the current working directory.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/' target='_blank' class='url' rel=\"noopener\">https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/<\/a><\/p>\n<h1>How to Set Up a Cron Job in cPanel Hosting (+ WP Cron)<\/h1>\n<p>Cron Jobs allow you to run scripts and automate repetitive tasks that can take up considerable time if done manually. In this post, we show you how to set up a cron job in cPanel and how to configure a real cron for WordPress.<\/p>\n<p>This tutorial covers the following:<\/p>\n<ul>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#what-is-cron-job'><strong>What is a Cron Job?<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#set-up-cron-job'><strong>How to Set Up a Cron Job in cPanel<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#email-cron-job'><strong>How to Get Email Notifications After Running a Cron Job<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#edit-cron-job'><strong>How to Edit a Cron Job<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#delete-cron-job'><strong>How to Delete a Cron Job<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#tips-cron-job'><strong>Useful Tips and Additional Information on Using Cron Jobs<\/strong><\/a><\/p>\n<\/li>\n<li>\n<p><strong>WordPress Cron (WP-Cron)<\/strong><\/p>\n<ul>\n<li><a href='https:\/\/premium.wpmudev.org\/blog\/set-up-cron-job-cpanel-wp-cron\/#real-wp-cron'><strong>How To Configure a Real Cron for WordPress<\/strong><\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>What is a Cron Job?<\/h2>\n<p>A <strong>cron job<\/strong> allows you to automate commands or scripts on your site that require being triggered at regular intervals or whenever specific events happen to complete repetitive tasks.<\/p>\n<p>cPanel includes a software utility called <strong>cron<\/strong> (from the Greek word for time, Chronos). This utility lets you schedule tasks that your system runs repeatedly. These tasks are called <strong>cron jobs<\/strong> or <strong>cron schedules<\/strong> and they are run from a file called <strong>crontab<\/strong> (CRON TABle) that lists all the tasks that cron needs to execute.<\/p>\n<p>You can set a command or script using cron jobs to run at a specific time every day, week, etc. For example, you could set a cron job to run a backup or delete temporary files to free up disk space on your server every week (or every two hours, or on a specific day of the month, or at 2:36 pm every Wednesday).<\/p>\n<p>Once a cron job is set up, it then runs automatically as per your schedule.<\/p>\n<h3>Parts of a Cron Command<\/h3>\n<p>A Cron Command typically consists of four parts:<\/p>\n<ul>\n<li><strong>Timing<\/strong>: this part lets you set when you\u2019d like your script to run by specifying regular intervals in terms of minutes, hours, days, months, and weekdays.<\/li>\n<li><strong>Execute<\/strong>: this part calls the PHP your cron job needs run, which is normally located in the path <code>\/usr\/bin\/php<\/code>.<\/li>\n<li><strong>Script Path<\/strong>: this is the full path of the file you want to run (e.g. <code>\/home\/user\/public_html\/index.php<\/code>)<\/li>\n<li><strong>Output<\/strong>: this optional part lets you write the cron output to a file or discard it. For example, to discard the output may require adding something like this: <code>\/dev\/null 2&gt;&amp;1<\/code>.<\/li>\n<\/ul>\n<p>Normally, any script that requires a cron job will provide you with the path or command you need to use that script. Your hosting provider may also supply or give you specific instructions for structuring your cron job commands. You then create a cron job using the path or command provided (and replace any placeholder strings in the line or command with your site\u2019s details, if required).<\/p>\n<p>In the screenshot below, for example, my cPanel dashboard has automatically provided some PHP command examples with my site\u2019s username (helpservices) and a sample PHP version included in the command path.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-216\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/ky3ldq9.png\" width=\"600\" height=\"164\" alt=\"PHP command examples.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/ky3ldq9.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/ky3ldq9-300x82.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/ky3ldq9-400x109.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>PHP command examples.<\/p>\n<p>Note: cPanel recommends having good knowledge of <a href='https:\/\/maker.pro\/linux\/tutorial\/basic-linux-commands-for-beginners'>Linux commands<\/a> to use cron jobs effectively and running your script past your hosting administrator before adding a cron job to avoid running into problems.<\/p>\n<h2>How to Set Up A Cron Job in cPanel<\/h2>\n<p>To set up a cron job in cPanel, log into your cPanel dashboard, then scroll down to the Advanced section and click on Cron Jobs.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-217\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/w2pq2vb.png\" width=\"600\" height=\"309\" alt=\"cPanel Dashboard - Cron Jobs\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/w2pq2vb.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/w2pq2vb-300x155.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/w2pq2vb-400x206.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Select Cron Jobs in cPanel\u2019s Advanced section.<\/p>\n<p>This brings up the <strong>Cron Jobs<\/strong> screen. Here, you can set up email notifications (see next section), add new cron jobs, and view a list of all the cron jobs you have set up and are currently running.<\/p>\n<p>Scroll down to the <strong>Add New Cron Job<\/strong> section. You can either select select a preset interval for your cron job to run from the Common Settings drop-down menus or enter your own custom values using the following options:<\/p>\n<ul>\n<li><strong>Minute:<\/strong> The number of minutes between each time the cron job runs, or the minute of each hour on which you wish to run the cron job.<\/li>\n<li><strong>Hour:<\/strong> The number of hours between each time the cron job runs, or the hour of each day on which you wish to run the cron job.<\/li>\n<li><strong>Day:<\/strong> The number of days between each time the cron job runs, or the day of the month on which you wish to run the cron job.<\/li>\n<li><strong>Month:<\/strong> The number of months between each time the cron job runs, or the month of the year in which you wish to run the cron job.<\/li>\n<li><strong>Weekday:<\/strong> The days of the week on which you wish to run the cron job.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-218\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/kbfanas.png\" width=\"600\" height=\"555\" alt=\"Cron - Common Settings\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/kbfanas.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/kbfanas-300x278.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/kbfanas-400x370.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Cron \u2013 Common Settings text boxes.<\/p>\n<p>The Common Settings menu contains typical cron job configuration settings with numbers or asterisks in parentheses indicating when the cron job should run.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-219\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/wjacku2.png\" width=\"600\" height=\"295\" alt=\"Cron - Common Settings menu.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/wjacku2.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/wjacku2-300x148.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/wjacku2-400x197.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Cron \u2013 Common Settings menu.<\/p>\n<p>If you select one of these settings, the system automatically populates the text boxes below with your selected settings.<\/p>\n<p>So, for example, if we select the option to set up a cron job to run a script once per week\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-220\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/tcyebvr.png\" width=\"600\" height=\"290\" alt=\"Cron - Common Settings: Weekly schedule.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tcyebvr.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tcyebvr-300x145.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tcyebvr-400x193.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Let\u2019s set our cron job to run once a week.<\/p>\n<p>The text boxes will be automatically populated with the values of our selected setting.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-221\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/tof7plp.png\" width=\"600\" height=\"309\" alt=\"Cron Job text boxes auto-populated with values to run once a week.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tof7plp.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tof7plp-300x155.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/tof7plp-400x206.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Cron Job text boxes auto-populated with values to run once a week.<\/p>\n<p>In the example above, our cron job is scheduled to run every Sunday of every month at exactly midnight.<\/p>\n<p>However, you can use the sub-drop-down menus to enter custom values into the text boxes. This lets you easily modify and adjust your cron job\u2019s scheduled intervals.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-222\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/50ryoen.png\" width=\"600\" height=\"720\" alt=\"Cron Job schedule with adjusted settings.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/50ryoen.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/50ryoen-300x360.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/50ryoen-400x480.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Adjust the settings of your cron job using the sub-drop-down menus and text boxes.<\/p>\n<p>The last step is to enter the actual command you want your cron job to run. You must specify the absolute path to the command you wish to run.<\/p>\n<p>Type or paste in the command into the <strong>Command:<\/strong> text box and click <strong>Add New Cron Job<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-223\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/nnvl0hf.png\" width=\"600\" height=\"570\" alt=\"Cron job command\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/nnvl0hf.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/nnvl0hf-300x285.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/nnvl0hf-400x380.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Type or paste in the cron job command.<\/p>\n<p>This will add your cron job to the Current Cron Jobs list.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-224\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/fuhm30m.png\" width=\"600\" height=\"174\" alt=\"Current cron jobs\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/fuhm30m.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/fuhm30m-300x87.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/fuhm30m-400x116.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Your cron job has been added to the Current Cron Jobs list.<\/p>\n<h2>How to Get Email Notifications After Running Cron Jobs<\/h2>\n<p>You can opt to receive (or stop receiving) emails every time a cron job runs a command that produces an output.<\/p>\n<p>This is useful if you want to know when one of your jobs fails to run and you want to review the errors.<\/p>\n<p>Just scroll down to the Cron Email section, enter an email address, and click the Update Email button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-225\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/pq2y0pz.png\" width=\"600\" height=\"315\" alt=\"Cron Email\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/pq2y0pz.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/pq2y0pz-300x158.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/pq2y0pz-400x210.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Get notified via email after a cron job is run.<\/p>\n<p>You can also elect not to receive emails after cron jobs are run:<\/p>\n<ul>\n<li>To disable email notifications for all cron jobs, remove the email address. To do this, leave the Email field blank and click the Update Email button. The current email address should display as <code>(none)<\/code>.<\/li>\n<li>To disable email notifications for a single cron job, add the information supplied by your host (see above screenshot) to redirect the command\u2019s output to <code>\/dev\/null<\/code>. (e.g. <code>\/usr\/local\/cpanel\/bin\/is_script_stuck \/dev\/null 2&gt;&amp;1<\/code>)<\/li>\n<\/ul>\n<h2>How to Edit a Cron Job<\/h2>\n<p>To edit your cron job settings, go to the Current Cron Jobs section and click the <strong>Actions &gt; Edit<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-226\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/6my7fhc.png\" width=\"600\" height=\"183\" alt=\"Edit cron job.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/6my7fhc.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/6my7fhc-300x92.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/6my7fhc-400x122.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Edit cron job.<\/p>\n<p>Change the values in the text boxes and click the Edit Line button to update your settings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-227\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/uegknv7.png\" width=\"600\" height=\"657\" alt=\"Edit cron job settings.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/uegknv7.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/uegknv7-300x329.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/uegknv7-400x438.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Edit cron job settings.<\/p>\n<p>Your cron job settings are now updated.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-228\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/cfxqm5z.png\" width=\"600\" height=\"184\" alt=\"Updated cron job settings.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/cfxqm5z.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/cfxqm5z-300x92.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/cfxqm5z-400x123.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Updated cron job settings.<\/p>\n<h2>How to Delete a Cron Job<\/h2>\n<p>To delete a cron job, go to the Current Cron Jobs section and click the <strong>Actions &gt; Delete<\/strong> link.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-229\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/buykbyw.png\" width=\"600\" height=\"184\" alt=\"Delete cron job.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/buykbyw.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/buykbyw-300x92.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/buykbyw-400x123.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Delete cron job.<\/p>\n<p>Confirm your deletion by pressing the Delete button.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-230\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/rk3ia36.png\" width=\"600\" height=\"268\" alt=\"Confirm cron job deletion.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rk3ia36.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rk3ia36-300x134.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rk3ia36-400x179.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Confirm cron job deletion.<\/p>\n<p>The selected cron job will be removed from the Current Cron Jobs section.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-231\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/bd42xl8.png\" width=\"600\" height=\"130\" alt=\"No cron jobs.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/bd42xl8.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/bd42xl8-300x65.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/bd42xl8-400x87.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>No current cron jobs.<\/p>\n<h2>Useful Tips and Additional Information on Using Cron Jobs<\/h2>\n<p>Here are some additional tips and useful information on using cron jobs:<\/p>\n<h3>If Cron Jobs Are Not Available in Your cPanel Dashboard<\/h3>\n<p>Some hosts do not allow users to run cron jobs. If your host has not made cron jobs available in your cPanel dashboard, you can still create and run cron jobs using external services like the ones listed below:<\/p>\n<ul>\n<li><a href='https:\/\/www.easycron.com\/'>EasyCron<\/a><\/li>\n<li><a href='https:\/\/www.setcronjob.com\/'>SetCronJob<\/a><\/li>\n<\/ul>\n<h3>How to Check if Your Cron Job Has Run<\/h3>\n<p>Some cron jobs produce output (e.g. a file, email, or web page) and others do not. It is easier to check if the cron ran for jobs that produce output.<\/p>\n<p>For cron jobs that perform tasks behind the scene and don\u2019t produce output, you will need to have root access to your server to check the logs and determine if the job has run as scheduled.<\/p>\n<p>You can check your server logs using an SSH client. Your host should provide the command to check the log for the cron script and the output will normally include the date and time the cron job has run, plus the server name, cron ID, cPanel username, and the command that ran. The name of the script should display at the end of the command.<\/p>\n<h3>How to Avoid Cronflicts<\/h3>\n<p>cPanel recommends exercising caution when scheduling cron jobs. You should allow enough time between cron jobs for the previous cron job to complete. If you schedule them to run too often, the server could start another cron job before the last cron job ends. This duplication can slow down your server and degrade its performance.<\/p>\n<p>Additionally, many hosts recommend not setting crons to run at regular intervals smaller than 5 minutes apart (some hosts won\u2019t even allow you to run them less than 15 minutes apart).<\/p>\n<h2>WordPress Cron (WP-Cron)<\/h2>\n<p>In addition to running cron jobs from your hosted server, WordPress also has an internal built-in function it uses to run scheduled tasks on WordPress sites, called <a href='https:\/\/premium.wpmudev.org\/blog\/schedule-functions-in-your-plugins-with-wordpress-cron\/'>WordPress Cron<\/a> (WP-Cron, wp-cron.php).<\/p>\n<p>WordPress core and many plugins need a scheduling system to perform time-based tasks. These rely on WP-Cron to run backend functions like checking for updates, creating backups, deleting old comments from trash, etc.<\/p>\n<p>Many hosting services are shared, however, and do not provide access to the system scheduler. WP-Cron allows WordPress to run on just about any hosting environment.<\/p>\n<p>Note: you can view and control cron events in the WP-Cron system using a plugin like <a href='https:\/\/wordpress.org\/plugins\/wp-crontrol\/'>WP Crontrol<\/a>.<\/p>\n<h3>How To Configure a Real Cron For WordPress<\/h3>\n<p>Although the WordPress built-in Cron handler is a really useful feature, WP-Cron is not a real cron job. It only simulates what a system cron does. However, WP-Cron does not run continuously. It is only triggered whenever someone visits your website.<\/p>\n<p>On high-traffic sites, WP-Cron is not an issue. As pointed out in the comments section of this post by one of our members (DavidAnderson of <a href='https:\/\/updraftplus.com\/'>UpdraftPlus.com<\/a>):<\/p>\n<ul>\n<li>The code in WordPress core is invoked on page loading only if there is an overdue cron job (i.e. only if needed).<\/li>\n<li>In a high traffic site, a cron job will run precisely on schedule. If you switch to an external cron caller, your cron job will only run when that schedule is hit.<\/li>\n<li>High-traffic sites tend to be more complicated and so have more cron jobs. On WP-Cron, jobs run precisely when needed. Switching to an external cron vastly increases the chances of your cron jobs not running on time, as they will now only run to whatever frequency you set their task (every 10 minutes, 5 minutes, 1 minute, etc.).<\/li>\n<\/ul>\n<p>On low-traffic sites, however, cron schedules can be missed if not enough frequent users visit the site to load a page.<\/p>\n<p>While experts from both our team and member community maintain that you should not disable WP-Cron and use an external cron scheduler unless you know exactly what you are doing, if you are ever asked to disable WP-Cron, here\u2019s how to do it:<\/p>\n<p>To disable WP-Cron, open the <code>wp-config.php<\/code> file for editing and add the following before the <em>\u201cThat\u2019s all, stop editing! Happy publishing.\u201d<\/em> line:<\/p>\n<pre><code>define(&#39;DISABLE_WP_CRON&#39;, true);\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-232\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/elawt3v.png\" width=\"600\" height=\"190\" alt=\"Disable WP-Cron.\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/elawt3v.png 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/elawt3v-300x95.png 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/elawt3v-400x127.png 400w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>Disable WP-Cron.<\/p>\n<p>Note: This disables WP-Cron from running on page load, not when called directly via <code>wp-cron.php<\/code>.<\/p>\n<p>You can then, set up your system\u2019s task scheduler to make a web request to the <code>wp-cron.php<\/code> file by creating a cron job and adding the following command (remember to replace <em>yourdomain.com<\/em> with your actual domain):<\/p>\n<pre><code>wget -q -O - http:\/\/yourdomain.com\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1\r\n<\/code><\/pre>\n<p>One last point to mention here (once again, thanks to DavidAnderson for raising this):<\/p>\n<p>The only real case for moving to an external cron is if you are on a very low-traffic site, you can\u2019t schedule external visits for some reason (e.g. your site is password protected), and it\u2019s important that those jobs run on time. Otherwise, just leave it alone and all will be well.<\/p>\n<p>We agree with this. Hence, if your sites run on <a href='https:\/\/premium.wpmudev.org\/hosting\/'>WPMU DEV hosting<\/a>, we automatically run WP-Cron every 5 minutes. Having a default preset cron helps low traffic sites, as it guarantees scheduled tasks to run every 5 minutes at least.<\/p>\n<p>Finally, as DavidAnderson also points out, if you have a lot of cron jobs, then even every 1 minute may not be enough to process them all. A number of popular plugins have jobs that are scheduled to run every minute. If those take significant time, they can delay others from running.<\/p>\n<h2>Cronfused Yet?<\/h2>\n<p>Don\u2019t be! And if this seems too <em>cronplicated<\/em>, don\u2019t worry. Fortunately, our team is here to provide 24\/7 expert help and support with anything you need.<\/p>\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"more wp-cron\">\n<p>&nbsp;<\/p>\n<p><a href='https:\/\/www.siteground.com\/tutorials\/wordpress\/real-cron-job\/' target='_blank' class='url' rel=\"noopener\">https:\/\/www.siteground.com\/tutorials\/wordpress\/real-cron-job\/<\/a><\/p>\n<h1>How to Replace the WordPress Cron with a Real Cron Job Tutorial<\/h1>\n<p>Because WordPress has to work on all sort of different platforms, OS\u2019s and configurations, it can\u2019t rely that there will be a cronjob service on the server that can handle scheduled tasks. This is why WordPress developers have created a workaround \u2013 the wp-cron.php file in your main WordPress folder is executed every time someone loads a page. It then checks if there\u2019s a scheduled task to be done and executes it if necessary.<\/p>\n<p>However, in some cases, this file may become a target of a DOS attack, or caching plugins can interfere with its execution which can cause either a lot of server load or the scheduled tasks may not execute properly and timely. This is why you can substitute this constant file execution with a real cron job.<\/p>\n<p>First, you need to disable the script to be executed every time someone loads one of your pages. To do this, open the <strong>wp-config.php<\/strong> file in your main WordPress folder and add the following line before the \u201c<em>\/* That\u2019s all, stop editing! Happy blogging. *\/<\/em>\u201d line:<\/p>\n<pre><code>define(&#39;DISABLE_WP_CRON&#39;, true);\r\n<\/code><\/pre>\n<p>Once you do that, you need to set up a real cron job and execute the wp-cron.php file with it. You don\u2019t want to trigger it too often \u2013 30 minutes should be fine for most of the websites. To do this, go to your <a href='https:\/\/tools.siteground.com\/cron'><strong>Site Tools<\/strong> &gt; <strong>Devs<\/strong> &gt; <strong>Cron Jobs<\/strong><\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-233\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/rtihe9c-1-1.jpg\" width=\"708\" height=\"377\" alt=\"img\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rtihe9c-1-1.jpg 708w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rtihe9c-1-1-300x160.jpg 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rtihe9c-1-1-600x319.jpg 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/rtihe9c-1-1-400x213.jpg 400w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Then, add the following command to be executed every 30 minutes:<\/p>\n<pre><code>wget -q -O - http:\/\/yourdomain.com\/wp-cron.php?doing_wp_cron &gt;\/dev\/null 2&gt;&amp;1\r\n<\/code><\/pre>\n<p>Replace <strong>yourdomain.com<\/strong> with your actual domain name. The <strong>Cron jobs<\/strong> tool has some of the most common schedules preset, so you can just select <strong>Twice Per Hour<\/strong> from the interval drop-down menu.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-234\" src=\"https:\/\/192.168.1.30\/wordpress\/wp-content\/uploads\/2021\/01\/zh2pcox-1-1.jpg\" width=\"708\" height=\"560\" alt=\"img\" srcset=\"https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/zh2pcox-1-1.jpg 708w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/zh2pcox-1-1-300x237.jpg 300w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/zh2pcox-1-1-600x475.jpg 600w, https:\/\/spiffynasty.com\/blahblahblah\/wp-content\/uploads\/2021\/01\/zh2pcox-1-1-400x316.jpg 400w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/p>\n<hr class=\"hrstyle5\">\n<h3>Asustor Nas CronJob<\/h3>\n<ul>\n<li>https:\/\/stackoverflow.com\/questions\/37305576\/can-t-get-cron-job-working-on-asustor-nas-model-as-302t\n<\/li>\n<li>https:\/\/stackoverflow.com\/questions\/36885909\/cronjob-does-not-execute-a-script-that-works-fine-standalone\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr>\n<p><a href='https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress' target='_blank' class='url' rel=\"noopener\">https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress<\/a><\/p>\n<h1>How to set up a WordPress cron job<\/h1>\n<p>This article describes how to configure a cron job for WordPress.<\/p>\n<details class=\"common-listing\" open=\"open\" style=\"box-sizing: border-box; display: block; padding: 30px; position: relative; border: 1px solid rgb(233, 234, 233); border-radius: 7px; background: rgb(250, 251, 250); margin-bottom: 25px; max-width: 582px;\">\n<summary style=\"box-sizing: border-box; display: block;\">Table of Contents<\/summary>\n<p style=\"box-sizing: border-box; margin: 0px 0px 17px; font-size: 16px; line-height: 26px;\">\n<ul id=\"toc\" title=\"Table of Contents\" style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">\n<li style=\"box-sizing: border-box; font-size: 18px; margin: 0px; line-height: 26px; list-style: none; position: relative; display: block; padding-left: 30px; font-family: myriadpro, sans-serif;\"><a href=\"https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress#The-virtual-WordPress-cron-job\" style=\"box-sizing: border-box; background-color: transparent; color: rgb(60, 55, 58); text-decoration: underline; outline: none; font-size: 18px; font-family: myriad-pro, sans-serif; font-weight: 300; display: block; line-height: 34px;\">The virtual WordPress \u201ccron job\u201d<\/a><\/li>\n<li style=\"box-sizing: border-box; font-size: 18px; margin: 0px; line-height: 26px; list-style: none; position: relative; display: block; padding-left: 30px; font-family: myriadpro, sans-serif;\"><a href=\"https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress#Disabling-the-virtual-WordPress-cron-job\" style=\"box-sizing: border-box; background-color: transparent; color: rgb(60, 55, 58); text-decoration: underline; outline: none; font-size: 18px; font-family: myriad-pro, sans-serif; font-weight: 300; display: block; line-height: 34px;\">Disabling the virtual WordPress cron job<\/a><\/li>\n<li style=\"box-sizing: border-box; font-size: 18px; margin: 0px; line-height: 26px; list-style: none; position: relative; display: block; padding-left: 30px; font-family: myriadpro, sans-serif;\"><a href=\"https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress#Configuring-a-real-cron-job-for-WordPress\" style=\"box-sizing: border-box; background-color: transparent; color: rgb(60, 55, 58); text-decoration: underline; outline: none; font-size: 18px; font-family: myriad-pro, sans-serif; font-weight: 300; display: block; line-height: 34px;\">Configuring a real cron job for WordPress<\/a>\n<ul style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">\n<li style=\"box-sizing: border-box; font-size: 18px; margin: 0px; line-height: 26px; list-style: none; position: relative; display: block; padding-left: 30px; font-family: myriadpro, sans-serif;\"><a href=\"https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress#Method-1.3A-Use-cPanel\" style=\"box-sizing: border-box; background-color: transparent; color: rgb(60, 55, 58); text-decoration: underline; outline: none; font-size: 18px; font-family: myriad-pro, sans-serif; font-weight: 300; display: block; line-height: 34px;\">Method #1: Use cPanel<\/a><\/li>\n<li style=\"box-sizing: border-box; font-size: 18px; margin: 0px; line-height: 26px; list-style: none; position: relative; display: block; padding-left: 30px; font-family: myriadpro, sans-serif;\"><a href=\"https:\/\/www.a2hosting.com\/kb\/installable-applications\/optimization-and-configuration\/wordpress2\/configuring-a-cron-job-for-wordpress#Method-2.3A-Use-the-command-line\" style=\"box-sizing: border-box; background-color: transparent; color: rgb(60, 55, 58); text-decoration: underline; outline: none; font-size: 18px; font-family: myriad-pro, sans-serif; font-weight: 300; display: block; line-height: 34px;\">Method #2: Use the command line<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/details>\n<h4>The virtual WordPress \u201ccron job\u201d<\/h4>\n<p>A cron job is a task scheduled to run automatically at specific intervals. For example, a cron job could automatically back up a file every six hours.<\/p>\n<p>In its default configuration, WordPress does not use a real cron job for scheduling and other related tasks. Instead, whenever a page is loaded on a WordPress site, WordPress runs the <em>wp-cron.php<\/em> file. Although this \u201cvirtual\u201d cron job is convenient, it has a few disadvantages:<\/p>\n<ul>\n<li>Running the <em>wp-cron.php<\/em> file every time WordPress loads a page is unnecessary, and can negatively affect server performance, particularly on sites that receive a lot of traffic.<\/li>\n<li>For a site that does not receive a lot of traffic on the other hand, it can be a significant amount of time before a visitor loads a page (and triggers the cron task). This can cause missed schedules for publishing posts and other unintended effects.<\/li>\n<\/ul>\n<p>To resolve these issues, you can disable the default virtual WordPress cron job, and configure a real cron job. To do this, follow the procedures below.<\/p>\n<h4>Disabling the virtual WordPress cron job<\/h4>\n<p>To disable the default virtual WordPress cron job, follow these steps:<\/p>\n<ol>\n<li>\n<p>Log in to your account using <a href='https:\/\/www.a2hosting.com\/kb\/cpanel\/getting-started-with-cpanel\/accessing-cpanel'>cPanel<\/a> or <a href='https:\/\/www.a2hosting.com\/kb\/getting-started-guide\/accessing-your-account\/using-ssh-secure-shell'>SSH<\/a>.<\/p>\n<\/li>\n<li>\n<p>Using the<\/p>\n<\/p>\n<p>cPanel File Manager<\/p>\n<\/p>\n<p>or the command line, open the<\/p>\n<\/p>\n<p>wp-config.php<\/p>\n<\/p>\n<p>file in a text editor.<\/p>\n<p>The <em>wp-config.php<\/em> file is located in the directory where you installed WordPress. Usually, this is the <em>public_html<\/em> directory.<\/p>\n<\/li>\n<li>\n<p>Add the following line to the<\/p>\n<\/p>\n<p>wp-config.php<\/p>\n<\/p>\n<p>file:<\/p>\n<pre><code>define(&#39;DISABLE_WP_CRON&#39;, true);\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<p>Make sure you add the previous line <strong>before<\/strong> the following line in the <em>wp-config.php<\/em> file:<\/p>\n<pre><code>\/* That&#39;s all, stop editing! Happy publishing. *\/\r\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Save the changes to the <em>wp-config.php<\/em> file and then exit the text editor. The virtual WordPress cron job is now disabled.<\/p>\n<\/li>\n<\/ol>\n<h4>Configuring a real cron job for WordPress<\/h4>\n<p>After you have disabled the default WordPress cron configuration in the <em>wp-config.php<\/em> file, you are ready to set up a real cron job that runs at fixed intervals regardless of site traffic.<\/p>\n<p>If your account includes cPanel access, you can use it to configure the cron job. Otherwise, you can configure the cron job from the command line.<\/p>\n<h5>Method #1: Use cPanel<\/h5>\n<p>To set up a WordPress cron job using cPanel, follow these steps:<\/p>\n<ol>\n<li>\n<p>Log in to cPanel.<\/p>\n<\/li>\n<li>\n<p>In the <strong>Advanced<\/strong> section of the cPanel home screen, click <strong>Cron jobs<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Under<\/p>\n<\/p>\n<p>Cron Email<\/p>\n<p>, type the e-mail address that you want to receive notifications, and then click<\/p>\n<\/p>\n<p>Update Email<\/p>\n<p>. Every time the cron job runs, the e-mail account will receive a message.<\/p>\n<p>If you do not want to receive e-mail notifications for the cron job, you can append &gt;\/dev\/null 2&gt;&amp;1 to the command, which redirects all output to <strong>\/dev\/null<\/strong>.<\/p>\n<\/li>\n<li>\n<p>Under<\/p>\n<\/p>\n<p>Add New Cron Job<\/p>\n<p>, in the<\/p>\n<\/p>\n<p>Common Settings<\/p>\n<\/p>\n<p>list box, select<\/p>\n<\/p>\n<p>Twice an hour<\/p>\n<p>.<\/p>\n<p>You can run cron jobs a maximum of every 15 minutes on shared and reseller accounts. A 30-minute interval for the WordPress cron job should be more than sufficient.<\/p>\n<\/li>\n<li>\n<p>In the<\/p>\n<\/p>\n<p>Command<\/p>\n<\/p>\n<p>text box, type the following line:<\/p>\n<pre><code>cd ${HOME}\/public_html; \/usr\/local\/bin\/php -q wp-cron.php\r\n<\/code><\/pre>\n<p>This line assumes that you installed WordPress in the document root (<strong>public_html<\/strong>) directory. If you installed WordPress in another directory, modify the <strong>cd<\/strong> command to change to that directory instead.<\/p>\n<\/li>\n<li>\n<p>Click <strong>Add New Cron Job<\/strong>. The new cron job settings take effect immediately.<\/p>\n<\/li>\n<\/ol>\n<h5>Method #2: Use the command line<\/h5>\n<p>To set up a WordPress cron job using the command line, follow these steps:<\/p>\n<ol>\n<li>\n<p>Log in to your account <a href='https:\/\/www.a2hosting.com\/kb\/getting-started-guide\/accessing-your-account\/using-ssh-secure-shell'>using SSH<\/a>.<\/p>\n<\/li>\n<li>\n<p>At the command prompt, type the following command:<\/p>\n<pre><code>crontab -e\r\n<\/code><\/pre>\n<\/li>\n<li>\n<p>Type o to enter editing mode and start a new line of text.<\/p>\n<\/li>\n<li>\n<p>Type the following line, replacing <em>username<\/em> with your own A2 Hosting account username:<\/p>\n<pre><code>*\/30 * * * *  cd ${HOME}\/public_html; \/usr\/local\/bin\/php -q wp-cron.php\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<ul>\n<li>This line sets the cron job to run every 30 minutes. If you are on an unmanaged platform you can run cron jobs as frequently as you want. On shared and reseller accounts, however, you can only run cron jobs a maximum of every 15 minutes. A 30-minute interval for the WordPress cron job should be more than sufficient.<\/li>\n<li>This line assumes that you installed WordPress in the document root (<strong>public_html<\/strong>) directory. If you installed WordPress in another directory, modify the <strong>cd<\/strong> command to change to that directory instead.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Press Esc, type :wq and then press Enter. The new cron job settings take effect immediately.<\/p>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"nas - email \/ cron\">\n<p><a href='https:\/\/askubuntu.com\/questions\/1020965\/how-do-i-set-cron-to-send-emails' target='_blank' class='url' rel=\"noopener\">https:\/\/askubuntu.com\/questions\/1020965\/how-do-i-set-cron-to-send-emails<\/a><\/p>\n<p>For this purposes you system should be able to send emails. So you could <strong>install and configure <code>postfix<\/code><\/strong>:<\/p>\n<pre><code>sudo apt install postfix\r\n<\/code><\/pre>\n<ul>\n<li>\n<p>For <em>General type of mail configuration<\/em> choose <strong>*Internet Site*<\/strong>, if you want to do more detailed configuration use the command:<\/p>\n<pre><code>sudo dpkg-reconfigure postfix\r\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><strong>At this stage Cron will start to send emails.<\/strong> Everything that usually will be outputted to the STDOUT (if you are execute a command in the command line), including all error messages, will be sent to the local mailbox of the user that runs the Cronjob.<\/p>\n<p>The default location of local user&#39;s mail boxes is <code>\/var\/mail\/<\/code>. You can install the command-line email client <code>mutt<\/code> to read your user&#39;s email box via the command line in a convenient way:<\/p>\n<pre><code>sudo apt install mutt\r\n<\/code><\/pre>\n<ul>\n<li>Note <code>mutt<\/code> installation process will involve installation and configuration of <code>postfix<\/code> if it isn&#39;t done before.<\/li>\n<\/ul>\n<p><strong>You can change the default destination mailbox<\/strong> by changing the value of the envvar <code>MAILTO<\/code> within <code>crontab<\/code>, before the definition of the Cronjob.<\/p>\n<p>Please note: unless you haven&#39;t enabled SSL\/TLS certificate within you send mail configuration, most of the public mail servers will ignore your emails in some way. For example <code>mail.google.com<\/code> will put them into the spam. If this is a server instance and you already have SSL\/TLS certificate for your primary domain follow <a href='https:\/\/www.upcloud.com\/support\/secure-postfix-using-lets-encrypt\/'>this nice manual<\/a> to attach it to Postfix.<\/p>\n<p>Once your system is able to send emails you must <strong>make your Cronjob more verbose<\/strong> (for e.g. add <code>-v<\/code> to the <code>rm<\/code> command) and must set proper value of <code>MAILTO<\/code>. So your <code>crontab<\/code> should look as this:<\/p>\n<pre><code>MAILTO=&quot;example.email@gmail.com&quot;\r\n* * * * * find \/nfs\/rpiggott\/complete -mtime +45 -exec rm -v {} \\;\r\n<\/code><\/pre>\n<hr \/>\n<p>Another approach is to create a script (which will be executed via <code>crontab<\/code>) that includes your command and uses <code>mail<\/code>, <code>mutt<\/code>, <code>ssmtp<\/code> or <code>sendmail<\/code> to send emails. See the bottom of the references for mor details.<\/p>\n<hr \/>\n<p>References and further reading:<\/p>\n<ul>\n<li><a href='https:\/\/askubuntu.com\/a\/1018301\/566421'>Issues getting crontab to work<\/a><\/li>\n<li><a href='https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-install-and-configure-postfix-on-ubuntu-16-04'>How To Install and Configure Postfix on Ubuntu 16.04<\/a><\/li>\n<li><a href='http:\/\/www.postfix.org\/TLS_README.html'>Postfix TLS Support<\/a><\/li>\n<li><a href='https:\/\/askubuntu.com\/q\/12917\/566421'>How to send mail from the command line?<\/a><\/li>\n<li><a href='https:\/\/tecadmin.net\/ways-to-send-email-from-linux-command-line\/'>5 Ways to Send Email From Linux Command Line<\/a><\/li>\n<\/ul>\n<\/div>\n<div class=\"su-tabs-pane su-u-clearfix su-u-trim\" data-title=\"tab\"><\/div><\/div><\/div>\n<!-- |||| end TABS  ---><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":285,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[27],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nas"],"_links":{"self":[{"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/comments?post=213"}],"version-history":[{"count":0,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/posts\/213\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/media\/285"}],"wp:attachment":[{"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/media?parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/categories?post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/spiffynasty.com\/blahblahblah\/wp-json\/wp\/v2\/tags?post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}