{"id":419,"date":"2014-04-01T21:52:32","date_gmt":"2014-04-01T21:52:32","guid":{"rendered":"http:\/\/nikola-breznjak.com\/blog\/?p=419"},"modified":"2015-08-20T11:35:53","modified_gmt":"2015-08-20T11:35:53","slug":"crontab-goodies","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/servers\/linux\/crontab-goodies\/","title":{"rendered":"How to use crontab in specific use cases"},"content":{"rendered":"<p>Here I will post non standard and &#8216;out of the ordinary&#8217; crontab settings. A note to myself (ANTM): crontab file in Centos is located in \/etc\/crontab.\u00a0Lets start:<\/p>\n<blockquote><p>Run a cron job every <strong>5<\/strong> minutes but starting from minute <strong>3<\/strong>.<\/p><\/blockquote>\n<p>Surely you can go about this like so:<\/p>\n<pre class=\"lang:default decode:true\">3,8,13,18,23,28,33,38,43,48,53,58 * * * * \/bin\/mycommand<\/pre>\n<p>but there&#8217;s much cleaner way of doing it:<\/p>\n<pre class=\"lang:default decode:true\">3-59\/5 * * * * \/bin\/mycommand<\/pre>\n<p>More info can be found on <a href=\"http:\/\/stackoverflow.com\/questions\/12786410\/run-cron-job-every-n-minutes-plus-offset\">this Stack Overflow question<\/a>\u00a0and also <a href=\"http:\/\/stackoverflow.com\/questions\/16094545\/cron-job-every-5-minutes-starting-from-a-specific-time\">another option is suggested here<\/a>\u00a0and goes like this:<\/p>\n<pre class=\"lang:default decode:true\">*\/5+3 * * * * \/bin\/mycommand<\/pre>\n<p>Similarly<\/p>\n<blockquote><p>Run a cron job every 5 minutes<\/p><\/blockquote>\n<pre class=\"lang:default decode:true\">*\/5 * * * * \/bin\/mycommand<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here I will post non standard and &#8216;out of the ordinary&#8217; crontab settings. A note to myself (ANTM): crontab file in Centos is located in \/etc\/crontab.\u00a0Lets start: Run&hellip;<\/p>\n","protected":false},"author":1,"featured_media":422,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26],"class_list":["post-419","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-cron-job"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=419"}],"version-history":[{"count":5,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions"}],"predecessor-version":[{"id":2122,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/419\/revisions\/2122"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/422"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}