{"id":8,"date":"2009-08-12T13:29:16","date_gmt":"2009-08-12T04:29:16","guid":{"rendered":"https:\/\/memo.cute.bz\/cakephp\/?p=8"},"modified":"2010-07-01T20:19:55","modified_gmt":"2010-07-01T11:19:55","slug":"cron-%e3%82%b8%e3%83%a7%e3%83%96","status":"publish","type":"post","link":"https:\/\/memo.cute.bz\/cakephp\/?p=8","title":{"rendered":"cron \u30b8\u30e7\u30d6"},"content":{"rendered":"<p>cron \u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306e\u65b9\u6cd5<\/p>\n<p>http:\/\/www.exsample.com\/controller\/action \u306e\u51e6\u7406\u3092 cron \u3067\u5b9f\u884c\u3059\u308b\u5834\u5408\u306e\u4f8b\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<p>Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229\u7528\u3057\u305f cron \u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3059\u308b\u5834\u5408\u306f\u4e0b\u8a18\u3092\u53c2\u7167\u3002<br \/>\n<a href=\"https:\/\/memo.cute.bz\/cakephp\/?p=13\" class=\"note\">Shell \u30af\u30e9\u30b9\u3092\u5229\u7528\u3057\u305f cron \u30b8\u30e7\u30d6<\/a><\/p>\n<p>\u6587\u4e2d\u3067\u4f7f\u7528\u3059\u308b PATH \u306f\u4e0b\u8a18\u306e\u901a\u308a\u5b9a\u7fa9\u3059\u308b\u3082\u306e\u3068\u3059\u308b\u3002<br \/>\n\u203b[VENDERS] \u306f CAKE_CORE_INCLUDE_PATH\/vendors<br \/>\n\u203b[APP] \u306f ROOT\/APP_DIR<\/p>\n<p><!--more--><\/p>\n<h3>cron.sh \u3092\u4f5c\u6210<\/h3>\n<p>[VENDORS]\/shells\/ \u914d\u4e0b\u306b cron.sh \u3092\u4f5c\u6210<\/p>\n<p>cron.sh \u306e\u5185\u5bb9\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n#! \/bin\/sh\r\n\/usr\/bin\/php $1\r\n<\/pre>\n<p>\u203b\/usr\/bin\/php \u306f PHP \u5b9f\u884c\u53ef\u80fd\u30d5\u30a1\u30a4\u30eb\u306e\u5834\u6240 (\u5927\u90e8\u5206\u306e Linux \u30b7\u30b9\u30c6\u30e0\u3067\u306f\u3001\/usr\/bin\/php \u304b \/usr\/local\/bin\/php)\u3002\u3088\u304f\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306b\u306f\u3001\u30b3\u30de\u30f3\u30c9 which php \u3067\u8abf\u67fb\u3002<\/p>\n<h3>controller_action.php \u306e\u4f5c\u6210<\/h3>\n<p>[APP]\/vendors\/shells\/cron\/ \u914d\u4e0b\u306b controller_action.php \u3092\u4f5c\u6210<\/p>\n<p>controller_action.php \u306e\u5185\u5bb9\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$_GET&#x5B;'url'] = &quot;controller\/action&quot;;\r\nrequire_once dirname(dirname(dirname(dirname(__FILE__)))) . &quot;\/index.php&quot;;\r\n<\/pre>\n<h3>cron \u30b8\u30e7\u30d6\u306e\u8a2d\u5b9a<\/h3>\n<p>cron \u30b8\u30e7\u30d6\u306e\u8a2d\u5b9a\u306f \/etc\/crontab \u306b\u4e0b\u8a18\u306e\u901a\u308a\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<pre>\u5206 \u6642 \u65e5 \u6708 \u66dc\u65e5 \u30e6\u30fc\u30b6 \u30b3\u30de\u30f3\u30c9<\/pre>\n<p>\u6bce\u66421\u5206\u306b cron \u3092\u5b9f\u884c\u3059\u308b\u4f8b<\/p>\n<pre>01 * * * * root sh [VENDORS]\/shells\/cron.sh [APP]\/vendors\/shells\/cron\/controller_action.php<\/pre>\n<h4>XREA \u3067\u8a2d\u5b9a\u3059\u308b\u5834\u5408<\/h4>\n<p>\u7ba1\u7406\u753b\u9762\u306eCRON\u30b8\u30e7\u30d6\u3067\u8a2d\u5b9a<\/p>\n<pre>\r\n\u5206 \u6642 \u65e5 \u6708 \u66dc\u65e5\r\n1 * * * *\r\n[VENDORS]\/shells\/cron.sh ~\/[APP]\/vendors\/shells\/cron\/controller_action.php >\/dev\/null 2>&1\r\n<\/pre>\n<p>\u203b\u3053\u3053\u3067 [VENDORS] \u304a\u3088\u3073 [APP] \u306f \/virtual\/[\u30a2\u30ab\u30a6\u30f3\u30c8\u540d]\/ \u306f\u542b\u307e\u306a\u3044\u3002<br \/>\n\u203b&gt;\/dev\/null 2>&#038;1 \u306f cron \u5b9f\u884c\u5185\u5bb9\u3092\u30e1\u30fc\u30eb\u3067\u9001\u4fe1\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002<\/p>\n<h3>\u53c2\u7167<\/h3>\n<p><a href=\"http:\/\/www.express.nec.co.jp\/linux\/distributions\/knowledge\/system\/crond.html\" class=\"note\">cron \u306e\u8a2d\u5b9a\u30ac\u30a4\u30c9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>cron \u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306e\u65b9\u6cd5 http:\/\/www.exsample.com\/controller\/action \u306e\u51e6\u7406\u3092 cron \u3067\u5b9f\u884c\u3059\u308b\u5834\u5408\u306e\u4f8b\u3092\u8a18\u8ff0\u3059\u308b\u3002 Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}