{"id":618,"date":"2023-03-22T12:23:18","date_gmt":"2023-03-22T03:23:18","guid":{"rendered":"https:\/\/www.bees-team.com\/?p=618"},"modified":"2023-03-22T12:30:43","modified_gmt":"2023-03-22T03:30:43","slug":"verify-if-crontab-works","status":"publish","type":"post","link":"https:\/\/www.bees-team.com\/?p=618","title":{"rendered":"Verify if crontab works"},"content":{"rendered":"<div class=\"post-content\"><div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>54 Second                <\/div>\n\n            <\/div><p>First of all, you have to check the\u00a0<strong>cronjob<\/strong>\u00a0status :<\/p>\n<pre><code>systemctl status cron\r\n<\/code><\/pre>\n<p>after that, run this command in the shell :<\/p>\n<pre><code>crontab -e\r\n<\/code><\/pre>\n<p>and add this line to\u00a0<strong>crontab<\/strong>:<\/p>\n<pre><code>* * * * * \/bin\/bash -l -c 'date &gt;&gt; \/tmp\/cron-test.txt'\r\n<\/code><\/pre>\n<p>this command writes the\u00a0<strong>current date every minute<\/strong>\u00a0in the cron-test file, you can watch the crontab output with the following:<\/p>\n<pre><code>cat \/tmp\/cron-test.txt\r\n<\/code><\/pre>\n<p>you should have an\u00a0<strong>output<\/strong>\u00a0like this after 4 minutes :<\/p>\n<pre><code>Mon Mar  6 11:55:01 UTC 2023\r\nMon Mar  6 11:56:01 UTC 2023\r\nMon Mar  6 11:57:01 UTC 2023\r\nMon Mar  6 11:58:01 UTC 2023\r\n<\/code><\/pre>\n<p>now, if you can see this output your crontab\u00a0<strong>works well<\/strong>, else you can see your log and find your issue&#8217;s reason<\/p>\n<pre><code>grep cron \/var\/log\/syslog\r\n<\/code><\/pre>\n<p>done.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Using systemctl:<\/strong><\/p>\n<pre><code>systemctl status cron\r\nsystemctl restart cron\r\n<\/code><\/pre>\n<p><strong>Older methods:<\/strong><br \/>\nOn CentOS and other Red Hat-based systems:<\/p>\n<pre><code>service crond status\r\nservice crond stop\r\nservice crond start\r\n<\/code><\/pre>\n<p>On Ubuntu and other Debian-based systems:<\/p>\n<pre><code>service cron status\r\nservice cron stop\r\nservice cron start<\/code><\/pre>\n        <div class=\"booster-block booster-reactions-block\">\n            <div class=\"twp-reactions-icons\">\n                \n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-1\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/happy.svg\" alt=\"Happy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Happy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-2\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sad.svg\" alt=\"Sad\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sad                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-3\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/excited.svg\" alt=\"Excited\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Excited                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-6\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/sleepy.svg\" alt=\"Sleepy\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">\n                        Sleepy                    <\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                        \n                                                <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-4\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/angry.svg\" alt=\"Angry\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Angry<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                        \n                    <\/div>\n                <\/div>\n\n                <div class=\"twp-reacts-wrap\">\n                    <a react-data=\"be-react-5\" post-id=\"618\" class=\"be-face-icons un-reacted\" href=\"javascript:void(0)\">\n                        <img decoding=\"async\" src=\"https:\/\/www.bees-team.com\/wp-content\/plugins\/booster-extension\/\/assets\/icon\/surprise.svg\" alt=\"Surprise\">\n                    <\/a>\n                    <div class=\"twp-reaction-title\">Surprise<\/div>\n                    <div class=\"twp-count-percent\">\n                                                    <span style=\"display: none;\" class=\"twp-react-count\">0<\/span>\n                                                                        <span class=\"twp-react-percent\"><span>0<\/span> %<\/span>\n                                            <\/div>\n                <\/div>\n\n            <\/div>\n        <\/div>\n\n    <\/div>","protected":false},"excerpt":{"rendered":"<p>First of all, you have to check the\u00a0cronjob\u00a0status : systemctl<a href=\"https:\/\/www.bees-team.com\/?p=618\">Read More<i class=\"fa fa-long-arrow-right\" aria-hidden=\"true\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":620,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-618","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Verify if crontab works - Experiment Log<\/title>\n<meta name=\"description\" content=\"Verify if crontab works\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Verify if crontab works - Experiment Log\" \/>\n<meta property=\"og:description\" content=\"Verify if crontab works\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bees-team.com\/?p=618\" \/>\n<meta property=\"og:site_name\" content=\"Experiment Log\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-22T03:23:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-22T03:30:43+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Bees-Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bees-Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618\"},\"author\":{\"name\":\"Bees-Team\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"headline\":\"Verify if crontab works\",\"datePublished\":\"2023-03-22T03:23:18+00:00\",\"dateModified\":\"2023-03-22T03:30:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618\"},\"wordCount\":99,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/crontab-1.jpg\",\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=618#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618\",\"name\":\"Verify if crontab works - Experiment Log\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/crontab-1.jpg\",\"datePublished\":\"2023-03-22T03:23:18+00:00\",\"dateModified\":\"2023-03-22T03:30:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\"},\"description\":\"Verify if crontab works\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bees-team.com\\\/?p=618\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#primaryimage\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/crontab-1.jpg\",\"contentUrl\":\"https:\\\/\\\/www.bees-team.com\\\/wp-content\\\/uploads\\\/2023\\\/03\\\/crontab-1.jpg\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/?p=618#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bees-team.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Verify if crontab works\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#website\",\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\",\"name\":\"Experiment Log\",\"description\":\"Just note what I did\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bees-team.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bees-team.com\\\/#\\\/schema\\\/person\\\/974321230684f994b6f3a28aa132b197\",\"name\":\"Bees-Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g\",\"caption\":\"Bees-Team\"},\"sameAs\":[\"https:\\\/\\\/www.bees-team.com\\\/\"],\"url\":\"https:\\\/\\\/www.bees-team.com\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Verify if crontab works - Experiment Log","description":"Verify if crontab works","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Verify if crontab works - Experiment Log","og_description":"Verify if crontab works","og_url":"https:\/\/www.bees-team.com\/?p=618","og_site_name":"Experiment Log","article_published_time":"2023-03-22T03:23:18+00:00","article_modified_time":"2023-03-22T03:30:43+00:00","og_image":[{"width":1280,"height":720,"url":"http:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg","type":"image\/jpeg"}],"author":"Bees-Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bees-Team","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bees-team.com\/?p=618#article","isPartOf":{"@id":"https:\/\/www.bees-team.com\/?p=618"},"author":{"name":"Bees-Team","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"headline":"Verify if crontab works","datePublished":"2023-03-22T03:23:18+00:00","dateModified":"2023-03-22T03:30:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=618"},"wordCount":99,"commentCount":0,"image":{"@id":"https:\/\/www.bees-team.com\/?p=618#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg","articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bees-team.com\/?p=618#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bees-team.com\/?p=618","url":"https:\/\/www.bees-team.com\/?p=618","name":"Verify if crontab works - Experiment Log","isPartOf":{"@id":"https:\/\/www.bees-team.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bees-team.com\/?p=618#primaryimage"},"image":{"@id":"https:\/\/www.bees-team.com\/?p=618#primaryimage"},"thumbnailUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg","datePublished":"2023-03-22T03:23:18+00:00","dateModified":"2023-03-22T03:30:43+00:00","author":{"@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197"},"description":"Verify if crontab works","breadcrumb":{"@id":"https:\/\/www.bees-team.com\/?p=618#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bees-team.com\/?p=618"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bees-team.com\/?p=618#primaryimage","url":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg","contentUrl":"https:\/\/www.bees-team.com\/wp-content\/uploads\/2023\/03\/crontab-1.jpg","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/www.bees-team.com\/?p=618#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bees-team.com\/"},{"@type":"ListItem","position":2,"name":"Verify if crontab works"}]},{"@type":"WebSite","@id":"https:\/\/www.bees-team.com\/#website","url":"https:\/\/www.bees-team.com\/","name":"Experiment Log","description":"Just note what I did","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bees-team.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bees-team.com\/#\/schema\/person\/974321230684f994b6f3a28aa132b197","name":"Bees-Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/add4cc7534eb8184e1e6e0291e67fde3d200af851c04f17ba570f8c50e71f09f?s=96&d=monsterid&r=g","caption":"Bees-Team"},"sameAs":["https:\/\/www.bees-team.com\/"],"url":"https:\/\/www.bees-team.com\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=618"}],"version-history":[{"count":2,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/618\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/posts\/618\/revisions\/622"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=\/wp\/v2\/media\/620"}],"wp:attachment":[{"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bees-team.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}