{"id":720,"date":"2018-11-29T15:43:40","date_gmt":"2018-11-29T08:43:40","guid":{"rendered":"http:\/\/www.oopsbox.com\/?p=720"},"modified":"2018-11-29T15:50:36","modified_gmt":"2018-11-29T08:50:36","slug":"implements-a-scheduled-task-using-supercronic","status":"publish","type":"post","link":"https:\/\/www.oopsbox.com\/?p=720","title":{"rendered":"Implements a scheduled task using Supercronic"},"content":{"rendered":"<p>Cron \u0e40\u0e1b\u0e47\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e17\u0e33 schedule tasks\u00a0 \u0e17\u0e35\u0e48\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23 \u0e1e\u0e1a\u0e40\u0e08\u0e2d\u0e44\u0e14\u0e49\u0e43\u0e19 <span class=\"st\">Unix-like OS \u0e15\u0e32\u0e21\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e44\u0e14\u0e49<a href=\"https:\/\/en.wikipedia.org\/wiki\/Cron\">\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48<\/a><\/span><\/p>\n<p>Supercronic \u0e01\u0e47\u0e08\u0e31\u0e14\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e02\u0e49\u0e32\u0e07\u0e15\u0e49\u0e19 \u0e04\u0e19\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e19\u0e34\u0e22\u0e32\u0e21\u0e27\u0e48\u0e32<\/p>\n<blockquote><p>Supercronic is a crontab-compatible job runner, designed specifically to run in containers.<\/p><\/blockquote>\n<p>\u0e40\u0e2b\u0e15\u0e38\u0e1c\u0e25\u0e17\u0e35\u0e48\u0e17\u0e33 Supercronic \u0e02\u0e36\u0e49\u0e19\u0e21\u0e32\u0e15\u0e32\u0e21\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e44\u0e14\u0e49<a href=\"https:\/\/www.aptible.com\/blog\/cron-for-containers-introduction-supercronic\/\">\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48<\/a> (\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e02\u0e35\u0e49\u0e40\u0e01\u0e35\u0e22\u0e08\u0e19\u0e30 55+) \u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e25\u0e2d\u0e07\u0e21\u0e32\u0e2d\u0e34\u0e21\u0e1e\u0e25\u0e35\u0e40\u0e21\u0e19\u0e17\u0e4c\u0e01\u0e31\u0e19\u0e14\u0e39<\/p>\n<p>\u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e47\u0e2a\u0e23\u0e49\u0e32\u0e07 Dockerfile \u0e15\u0e32\u0e21\u0e19\u0e35\u0e49<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">FROM alpine:3.8\r\nLABEL author=\"mf\"\r\nLABEL version=\"latest\"\r\n\r\nENV SUPERCRONIC_VERSION=\"v0.1.6\" \\\r\n    SUPERCRONIC_PACKAGE=supercronic-linux-amd64 \\\r\n    SUPERCRONIC_SHA1SUM=c3b78d342e5413ad39092fd3cfc083a85f5e2b75\r\n\r\nENV SUPERCRONIC_URL=https:\/\/github.com\/aptible\/supercronic\/releases\/download\/$SUPERCRONIC_VERSION\/$SUPERCRONIC_PACKAGE\r\n\r\nENV TZ Asia\/Bangkok\r\n\r\n# install dependencies\r\nRUN apk add --update --no-cache ca-certificates curl \\\r\n# install supercronic\r\n    &amp;&amp; curl -fsSLO \"$SUPERCRONIC_URL\" \\\r\n    &amp;&amp; echo \"${SUPERCRONIC_SHA1SUM}  ${SUPERCRONIC_PACKAGE}\" | sha1sum -c - \\\r\n    &amp;&amp; chmod +x \"${SUPERCRONIC_PACKAGE}\" \\\r\n    &amp;&amp; mv \"${SUPERCRONIC_PACKAGE}\" \"\/bin\/${SUPERCRONIC_PACKAGE}\" \\\r\n    &amp;&amp; ln -s \"\/bin\/${SUPERCRONIC_PACKAGE}\" \/bin\/supercronic \\\r\n# remove unwanted deps &amp; cleanup\r\n    &amp;&amp; apk del --purge ca-certificates curl \\\r\n    &amp;&amp; rm -rf \/tmp\/* \/var\/cache\/apk\/*\r\n\r\nADD crontab.sample \/etc\/crontab\r\nRUN chmod 0644 \/etc\/crontab\r\n\r\nENTRYPOINT [\"supercronic\"]\r\nCMD [\"\/etc\/crontab\"]<\/pre>\n<p>** \u0e13 \u0e15\u0e2d\u0e19\u0e19\u0e35\u0e49 (29 \u0e1e.\u0e22. 61) \u0e40\u0e27\u0e2d\u0e23\u0e4c\u0e0a\u0e31\u0e48\u0e19\u0e25\u0e48\u0e32\u0e2a\u0e38\u0e14\u0e2d\u0e22\u0e39\u0e48\u0e17\u0e35\u0e48 0.1.6 \u0e25\u0e2d\u0e07\u0e40\u0e0a\u0e47\u0e04\u0e14\u0e39\u0e40\u0e23\u0e37\u0e48\u0e2d\u0e22 \u0e46 \u0e17\u0e35\u0e48 <a href=\"https:\/\/github.com\/aptible\/supercronic\">Github<\/a><\/p>\n<p>\u0e15\u0e32\u0e21\u0e14\u0e49\u0e27\u0e22\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c Crontab \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e17\u0e33\u0e07\u0e32\u0e19 \u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07 \u0e04\u0e37\u0e2d\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e43\u0e2b\u0e49\u0e41\u0e2a\u0e14\u0e07\u0e1c\u0e25\u0e04\u0e33\u0e27\u0e48\u0e32 &#8220;hello from Supercronic&#8221; \u0e17\u0e38\u0e01 1 \u0e19\u0e32\u0e17\u0e35<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># Run every minute\r\n*\/1 * * * * echo \"hello from Supercronic\"<\/pre>\n<p>\u0e40\u0e2a\u0e23\u0e47\u0e08\u0e01\u0e47\u0e17\u0e33\u0e01\u0e32\u0e23 Build \u0e41\u0e25\u0e30\u0e23\u0e31\u0e19 container <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo docker build -t mf\/supercronic . &amp;&amp; sudo docker run -it mf\/supercronic<\/code>\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e08\u0e30\u0e44\u0e14\u0e49\u0e15\u0e32\u0e21\u0e19\u0e35\u0e49<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-721\" src=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20181129152854-793x568.png\" alt=\"\" width=\"793\" height=\"568\" srcset=\"https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20181129152854-793x568.png 793w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20181129152854-793x568-300x215.png 300w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20181129152854-793x568-768x550.png 768w, https:\/\/www.oopsbox.com\/wp-content\/uploads\/Screenshot-20181129152854-793x568-700x501.png 700w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/p>\n<p>\u0e08\u0e1a\u0e1b\u0e34\u0e4a\u0e07 ^__^<\/p>\n<p><strong>Source<\/strong><\/p>\n<ul>\n<li>https:\/\/github.com\/aptible\/supercronic<\/li>\n<\/ul>\n<div id=\"s-share-buttons\" class=\"\"><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"fb-share-button\" data-href=\"https:\/\/www.oopsbox.com\/?p=720\" data-type=\"button_count\"><\/div><\/div><div class=\"s-single-share\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\"><\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"g-plusone\" data-size=\"medium\"><\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"\/\/www.pinterest.com\/pin\/create\/button\/\" data-pin-do=\"buttonBookmark\"  data-pin-color=\"red\"><img decoding=\"async\" src=\"\/\/assets.pinterest.com\/images\/pidgets\/pinit_fg_en_rect_red_20.png\" \/><\/a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<script type=\"text\/javascript\" async defer src=\"\/\/assets.pinterest.com\/js\/pinit.js\"><\/script>\n\t\t\t\t\t\t\t\t\t\t\t\t<\/div><div class=\"s-single-share\">\n\t\t\t\t\t\t\t\t\t\t\t\t<a href=\"mailto:?Subject=Implements%20a%20scheduled%20task%20using%20Supercronic&Body=Here%20is%20the%20link%20to%20the%20article:%20https:\/\/www.oopsbox.com\/?p=720\" title=\"Email\" class=\"s3-email\"><img decoding=\"async\" src=\"https:\/\/www.oopsbox.com\/wp-content\/plugins\/simple-social-share\/includes\/..\/images\/share-email.png\"><\/a>\n\t\t\t\t\t\t\t\t\t\t\t<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Cron \u0e40\u0e1b\u0e47\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e17\u0e33 schedule tasks\u00a0 \u0e17\u0e35\u0e48\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23 \u0e1e\u0e1a\u0e40\u0e08\u0e2d\u0e44\u0e14\u0e49\u0e43\u0e19 Unix-like OS \u0e15\u0e32\u0e21\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e44\u0e14\u0e49\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48 Supercronic \u0e01\u0e47\u0e08\u0e31\u0e14\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19\u0e42\u0e1b\u0e23\u0e41\u0e01\u0e23\u0e21\u0e02\u0e49\u0e32\u0e07\u0e15\u0e49\u0e19 \u0e04\u0e19\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e19\u0e34\u0e22\u0e32\u0e21\u0e27\u0e48\u0e32 Supercronic is a crontab-compatible job runner, designed specifically to run in containers. \u0e40\u0e2b\u0e15\u0e38\u0e1c\u0e25\u0e17\u0e35\u0e48\u0e17\u0e33 Supercronic \u0e02\u0e36\u0e49\u0e19\u0e21\u0e32\u0e15\u0e32\u0e21\u0e44\u0e1b\u0e2d\u0e48\u0e32\u0e19\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e44\u0e14\u0e49\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48 (\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e02\u0e35\u0e49\u0e40\u0e01\u0e35\u0e22\u0e08\u0e19\u0e30 55+) \u0e17\u0e35\u0e48\u0e19\u0e35\u0e49\u0e40\u0e23\u0e32\u0e25\u0e2d\u0e07\u0e21\u0e32\u0e2d\u0e34\u0e21\u0e1e\u0e25\u0e35\u0e40\u0e21\u0e19\u0e17\u0e4c\u0e01\u0e31\u0e19\u0e14\u0e39 \u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e47\u0e2a\u0e23\u0e49\u0e32\u0e07 Dockerfile \u0e15\u0e32\u0e21\u0e19\u0e35\u0e49 FROM alpine:3.8 LABEL author=&#8221;mf&#8221; LABEL version=&#8221;latest&#8221; ENV SUPERCRONIC_VERSION=&#8221;v0.1.6&#8243; \\ SUPERCRONIC_PACKAGE=supercronic-linux-amd64 \\ SUPERCRONIC_SHA1SUM=c3b78d342e5413ad39092fd3cfc083a85f5e2b75 ENV SUPERCRONIC_URL=https:\/\/github.com\/aptible\/supercronic\/releases\/download\/$SUPERCRONIC_VERSION\/$SUPERCRONIC_PACKAGE ENV TZ Asia\/Bangkok # install dependencies RUN apk &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.oopsbox.com\/?p=720\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Implements a scheduled task using Supercronic&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":722,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[84,83,85,82],"class_list":["post-720","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-note","tag-container","tag-cron","tag-scheduled-task","tag-supercronic","entry"],"views":2974,"_links":{"self":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/720","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=720"}],"version-history":[{"count":2,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/720\/revisions"}],"predecessor-version":[{"id":724,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/posts\/720\/revisions\/724"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=\/wp\/v2\/media\/722"}],"wp:attachment":[{"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.oopsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}