{"id":2496,"date":"2022-09-16T17:33:54","date_gmt":"2022-09-16T17:33:54","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=2496"},"modified":"2022-09-16T17:33:55","modified_gmt":"2022-09-16T17:33:55","slug":"use-cron-to-automate-tasks-on-ubuntu-lts-centos","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/","title":{"rendered":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1.jpg\" alt=\"Use Cron to Automate Tasks\non Ubuntu \/ CentOS \/ REDHAR RHEL\" class=\"wp-image-2588\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Linux&#8217;s distributions (Ubuntu, CentOS, RHEL) and other Unix-like operating systems have the time-based job scheduling daemon known as <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cron\" target=\"_blank\" rel=\"noreferrer noopener\">Cron<\/a>. Cron is excellent for automating chores connected to maintenance since it works in the background and actions planned with it, known as \u201ccron jobs,\u201d are carried out automatically.<\/p>\n\n\n\n<p>This tutorial offers instructions for scheduling jobs using the unique syntax of cron. It also discusses a few shortcuts you may take to speed up and improve the readability of task schedules.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>To complete this guide, you will need access to a server running Ubuntu LTS or CentOS.<\/p>\n\n\n\n<p>No matter what sort of computer you use to follow this instruction, it should be set with a non-root user who has root access. To set up One, follow our guide on <a href=\"https:\/\/www.webhi.com\/how-to\/create-a-new-sudo-enabled-user-in-ubuntu-18-04-20-04-22-04-lts-centos-7\/\">Creating a New sudo-enabled User in Ubuntu LTS &amp; CentOS 7<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Installing Cron<\/h2>\n\n\n\n<p>Nearly&nbsp;all&nbsp;Linux&nbsp;distribution&nbsp;features&nbsp;its&nbsp;own&nbsp;sort&nbsp;of&nbsp;cron&nbsp;installed&nbsp;by&nbsp;simply&nbsp;default.&nbsp;However,&nbsp;in&nbsp;the&nbsp;even that&nbsp;you&nbsp;are&nbsp;using&nbsp;the&nbsp;Ubuntu&nbsp;machine&nbsp;in&nbsp;which&nbsp;cron&nbsp;is&nbsp;not&nbsp;installed,&nbsp;you&nbsp;could&nbsp;mount&nbsp;it&nbsp;using&nbsp;APT.<\/p>\n\n\n\n<p>Before&nbsp;installing&nbsp;cron&nbsp;on&nbsp;the&nbsp;machine,&nbsp;update&nbsp;the&nbsp;computer&nbsp;&#8216;s&nbsp;local&nbsp;package&nbsp;index:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><kbd>Ubuntu<\/kbd><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt update<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center\"><kbd>CentOS<\/kbd><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo yum update<\/code><\/pre>\n\n\n\n<p>And&nbsp;then&nbsp;install&nbsp;cron&nbsp;with&nbsp;the&nbsp;following&nbsp;command:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><kbd>Ubuntu<\/kbd><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt install cron<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center\"><kbd>CentOS<\/kbd><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo yum install cron<\/code><\/pre>\n\n\n\n<p>You&nbsp;will&nbsp;need&nbsp;to&nbsp;be&nbsp;sure&nbsp;it\u2019s set to run in the background, too:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo systemctl enable cron<\/code><\/pre>\n\n\n\n<pre title=\"Output\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">root@Ubuntu:~# sudo systemctl enable cron\nSynchronizing state of cron.service with SysV service script with \/lib\/systemd\/systemd-sysv-install.\nExecuting: \/lib\/systemd\/systemd-sysv-install enable cron<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 : Just how&nbsp;Cron&nbsp;Works<\/h2>\n\n\n\n<p>Cron jobs are documented and managed in a special document termed as a crontab. Every account on the system might have their own crontab where they can schedule jobs, which is stored under <kbd>\/var\/spool\/cron\/crontabs\/<\/kbd> .<\/p>\n\n\n\n<p>To schedule a job, open up your crontab for editing and add a job written in the form of a cron expression. The particular syntax for cron expressions can be separated into two elements: the schedule and the command to execute.<\/p>\n\n\n\n<p>You&nbsp;should&nbsp;use&nbsp;almost&nbsp;any&nbsp;command&nbsp;you&nbsp;would&nbsp;normally&nbsp;run&nbsp;using&nbsp;the&nbsp;order&nbsp;line.&nbsp;the&nbsp;plan&nbsp;component&nbsp;is split up into&nbsp;5&nbsp;different&nbsp;fields,&nbsp;which&nbsp;are&nbsp;written&nbsp;in&nbsp;the&nbsp;following&nbsp;command:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-center\" data-align=\"center\"><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>1st<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>2nd<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>3rd<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>4th<\/strong><\/th><th class=\"has-text-align-center\" data-align=\"center\"><strong>5th<\/strong><\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><td class=\"has-text-align-center\" data-align=\"center\">*<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>ID<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\">Minute<\/td><td class=\"has-text-align-center\" data-align=\"center\">Hour<\/td><td class=\"has-text-align-center\" data-align=\"center\">Day-Date<\/td><td class=\"has-text-align-center\" data-align=\"center\">Month<\/td><td class=\"has-text-align-center\" data-align=\"center\">Day Name<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\"><strong>Allowed Values<\/strong><\/td><td class=\"has-text-align-center\" data-align=\"center\"><kbd>0-59<\/kbd><\/td><td class=\"has-text-align-center\" data-align=\"center\"><kbd>0-23<\/kbd><\/td><td class=\"has-text-align-center\" data-align=\"center\"><kbd>1-31<\/kbd><\/td><td class=\"has-text-align-center\" data-align=\"center\"><kbd>1-12<\/kbd> or <kbd>JAN-DEC<\/kbd><\/td><td class=\"has-text-align-center\" data-align=\"center\"><kbd>0-6<\/kbd> or <kbd>SUN-SAT<\/kbd><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Each, task scheduled in a crontab is structured like the following :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ * * * * *  &lt;command&gt; \n# OR \n$ * * * * * &lt;path\/to\/script&gt;<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Example&nbsp;:<\/h5>\n\n\n\n<p>This command is set to run the job at 00:00 [midnight] every Sunday<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">0 0 * * 0 curl webhi.com<\/code><\/pre>\n\n\n\n<h5 class=\"has-text-align-center wp-block-heading\"><kbd>Note :<\/kbd><\/h5>\n\n\n\n<pre class=\"wp-block-preformatted\"><kbd>*<\/kbd> : In cron expressions, an asterisk is a wildcard variable that represents \u201call.\u201d Thus, a task scheduled with * * * * * will run every minute of every hour of every day of every month.\n<kbd>,<\/kbd> : Commas break up scheduling values to form a list. If you want to have a task run at the beginning and middle of every hour, rather than writing out two separate tasks\n<kbd>-<\/kbd> : A hyphen represents a range of values in the schedule field.\n<kbd>\/<\/kbd> : You can use a forward slash with an asterisk to express a step value.<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted has-cyan-bluish-gray-background-color has-background has-small-font-size\">Note: It is important to note that you cannot express step values indiscriminately; you must use integers that divide evenly within the range permitted by the field in question. In the \"hours\" column, for example, you could only enter 1, 2, 3, 4, 5, 6, 7, or 12 after a forward slash.<\/pre>\n\n\n\n<p>Here are some further examples of how to utilize the scheduling component of cron:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><kbd>* * * * *<\/kbd> - Every minute.\n<kbd>12 * * * *<\/kbd> - 12 minutes of after every hour.\n<kbd>(0,15,30,45 * * * *)<\/kbd> \/ <kbd>(*\/15 * * * *)<\/kbd> - Every 15 minutes.\n<kbd>0 4 * * *<\/kbd> -Every day at 4:00 AM.\n<kbd>0 4 * * 2-4<\/kbd> -Every Tuesday, Wednesday, and Thursday at 4AM.\n<kbd>20,40 *\/8 * 7-12 *<\/kbd> -Every day throughout the last six months of the year, on the 20th and 40th minutes of the 8&nbsp;hour.<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Editing Crontabs<\/h2>\n\n\n\n<p>A <strong>cron<\/strong>, as previously stated, is a special file that stores the schedule of jobs that cron will run. However, these are not designed to be altered directly. It is instead advised that you use the <kbd>crontab<\/kbd> command. This allows you to change your user profile crontabs without having to use sudo. The crontab command will also notify you if there are any syntax mistakes in the crontab, but directly changing it would not.<\/p>\n\n\n\n<p>You can modify your crontab by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ crontab -e<\/code><\/pre>\n\n\n\n<pre title=\"Output :\" class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">no crontab for bob - using an empty one\n\nSelect an editor.  To change later, run 'select-editor'.\n  1. \/bin\/nano        &lt;---- easiest\n  2. \/usr\/bin\/vim.basic\n  3. \/usr\/bin\/vim.tiny\n  4. \/bin\/ed\n\nChoose 1-4 [1]:<\/code><\/pre>\n\n\n\n<p>Enter the number corresponding to the editor of your choice. Alternatively, you might press <kbd>ENTER<\/kbd> to accept the default choice, nano.<\/p>\n\n\n\n<p>When you use <kbd>crontab -e<\/kbd> in the future, it will automatically open your crontab in this text editor.<\/p>\n\n\n\n<p>After you&#8217;ve made your choice, you&#8217;ll be led to a new crontab with some commented-out instructions on how to use it:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-text-color has-background\" style=\"background-color:#131313;color:#3a96dd\"># Edit this file to introduce tasks to be run by cron.\n#\n# Each task to run has to be defined through a single line\n# indicating with different fields when the task will be run\n# and what command to run for the task\n#\n# To define the time you can provide concrete values for\n# minute (m), hour (h), day of month (dom), month (mon),\n# and day of week (dow) or use '*' in these fields (for 'any').\n#\n# Notice that tasks will be started based on the cron's system\n# daemon's notion of time and timezones.\n#\n# Output of the crontab jobs (including errors) is sent through\n# email to the user the crontab file belongs to (unless redirected).\n#\n# For example, you can run a backup of all your user accounts\n# at 5 a.m every week with:\n# 0 5 * * 1 tar -zcf \/var\/backups\/home.tgz \/home\/\n#\n# For more information see the manual pages of crontab(5) and cron(8)\n#\n# m h  dom mon dow   command<\/pre>\n\n\n\n<p>You may use the following command to inspect the contents of your crontab and&nbsp;not edit it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ crontab -l<\/code><\/pre>\n\n\n\n<p>You may clear your <kbd>crontab<\/kbd> by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-vivid-red-color has-text-color has-background\" style=\"background-color:#e19f9f;font-size:15px;font-style:normal;font-weight:800\"><strong><mark style=\"background-color:#d34646\" class=\"has-inline-color\">Warning:<\/mark><\/strong> The following command will not prompt you for confirmation that you wish to delete your <kbd>crontab<\/kbd>. Run it only if you are certain you want to delete it.<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ crontab -r<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Cron is a flexible and powerful utility that can ease the burden of many tasks associated with system administration. Combined with shell scripts, it can automate normally tedious and complex tasks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Linux&#8217;s distributions (Ubuntu, CentOS, RHEL) and other Unix-like operating systems have the time-based job scheduling daemon known as Cron. Cron is excellent for automating chores connected to maintenance since it works in the background and actions planned with it, known as \u201ccron jobs,\u201d are carried out automatically. This tutorial offers instructions for scheduling jobs ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69],"tags":[],"yoast_head":"\n<title>Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-16T17:33:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-09-16T17:33:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS\",\"datePublished\":\"2022-09-16T17:33:54+00:00\",\"dateModified\":\"2022-09-16T17:33:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\"},\"wordCount\":700,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\",\"name\":\"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2022-09-16T17:33:54+00:00\",\"dateModified\":\"2022-09-16T17:33:55+00:00\",\"description\":\"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations","description":"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/","og_locale":"en_US","og_type":"article","og_title":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations","og_description":"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.","og_url":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2022-09-16T17:33:54+00:00","article_modified_time":"2022-09-16T17:33:55+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/09\/cron_ubuntu_centos_en-1.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS","datePublished":"2022-09-16T17:33:54+00:00","dateModified":"2022-09-16T17:33:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/"},"wordCount":700,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/","url":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/","name":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2022-09-16T17:33:54+00:00","dateModified":"2022-09-16T17:33:55+00:00","description":"This tutorial offers instructions for scheduling jobs using the unique syntax of cron. on Ubuntu LTS and CentOS.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/use-cron-to-automate-tasks-on-ubuntu-lts-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"Use Cron to Automate Tasks on Ubuntu LTS \/ CentOS"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1782424353","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/2496"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=2496"}],"version-history":[{"count":100,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/2496\/revisions"}],"predecessor-version":[{"id":2725,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/2496\/revisions\/2725"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=2496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=2496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=2496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}