{"id":13,"date":"2010-07-01T20:17:22","date_gmt":"2010-07-01T11:17:22","guid":{"rendered":"https:\/\/memo.cute.bz\/cakephp\/?p=13"},"modified":"2010-07-01T20:23:38","modified_gmt":"2010-07-01T11:23:38","slug":"shell-%e3%82%af%e3%83%a9%e3%82%b9%e3%82%92%e5%88%a9%e7%94%a8%e3%81%97%e3%81%9f-cron-%e3%82%b8%e3%83%a7%e3%83%96","status":"publish","type":"post","link":"https:\/\/memo.cute.bz\/cakephp\/?p=13","title":{"rendered":"Shell \u30af\u30e9\u30b9\u3092\u5229\u7528\u3057\u305f cron \u30b8\u30e7\u30d6"},"content":{"rendered":"<p>Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229\u7528\u3057\u305f cron \u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306e\u65b9\u6cd5\u3002<\/p>\n<p>cron \u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u65b9\u6cd5\u3068\u3057\u3066\u3001\u4efb\u610f\u306e URL \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u3068 Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229\u7528\u3057\u3066\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u306e\uff12\u901a\u308a\u304c\u3042\u308b\u3002<\/p>\n<p><!--more--><\/p>\n<h3>\u30e1\u30ea\u30c3\u30c8\u3068\u30c7\u30e1\u30ea\u30c3\u30c8<\/h3>\n<p>URL \u3078\u306e\u30a2\u30af\u30bb\u30b9\u3068 Cake \u30b3\u30de\u30f3\u30c9\u3067\u306e\u51e6\u7406\u65b9\u6cd5\u306b\u306f\u30e1\u30ea\u30c3\u30c8\u30fb\u30c7\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308b\u306e\u3067\u4f7f\u3044\u5206\u3051\u304c\u5fc5\u8981\u3002<\/p>\n<h4>URL \u3078\u306e\u30a2\u30af\u30bb\u30b9<\/h4>\n<p>URL \u3078\u306e\u30a2\u30af\u30bb\u30b9\u306f\u3001\u30d6\u30e9\u30a6\u30b6\u7b49\u3067\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u305f\u5834\u5408\u3067\u3082\u51e6\u7406\u304c\u53ef\u80fd\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u7b2c\u4e09\u8005\u306b\u30a2\u30c9\u30ec\u30b9\u3092\u77e5\u3089\u308c\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u306b\u4e88\u671f\u305b\u305a\u51e6\u7406\u304c\u8d70\u3063\u3066\u3057\u307e\u3046\u3002<br \/>\n\u7b2c\u4e09\u8005\u306b\u51e6\u7406\u3092\u3055\u305b\u305f\u304f\u306a\u3044\u5834\u5408\u306f\u3001IP \u30a2\u30c9\u30ec\u30b9\u3067\u30d5\u30a3\u30eb\u30bf\u3059\u308b\u306a\u3069\u306e\u5bfe\u51e6\u304c\u5fc5\u8981\u3002<br \/>\n\u4f7f\u7528\u3057\u3066\u3044\u308b\u30b5\u30fc\u30d0\u3067 cron \u304c\u4f7f\u7528\u3067\u304d\u306a\u3044\u74b0\u5883\u3067\u306f\u3001\u5916\u90e8\u3067 cron \u3092\u5b9f\u884c\u3059\u308b Web\u30b5\u30fc\u30d3\u30b9\u306a\u3069\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u64ec\u4f3c\u7684\u306b cron \u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u53ef\u80fd\u3002<\/p>\n<p>\u203b\u53c2\u7167<br \/>\n<a href=\"http:\/\/www.webcron.org\/\" class=\"note\">Monitor Web Server and Web Based Cron &#8211; Webcron.org &#8211; Home<\/a><\/p>\n<h4>Cake \u30b3\u30de\u30f3\u30c9<\/h4>\n<p>\u30b7\u30a7\u30eb\u30b3\u30de\u30f3\u30c9\u306e\u307f\u3067\u51e6\u7406\u3092\u3057\u3001\u7b2c\u4e09\u8005\u304b\u3089\u51e6\u7406\u3092\u5b9f\u884c\u3055\u308c\u308b\u3053\u3068\u304c\u305f\u3081\u5b89\u5fc3\u5b89\u5168\u3002<br \/>\ncron \u304c\u5229\u7528\u3067\u304d\u306a\u74b0\u5883\u3067\u306f\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3002<br \/>\n\u69cb\u6210\u304c\u30b7\u30f3\u30d7\u30eb\u306a\u305f\u3081\u5b9f\u88c5\u304c\u5bb9\u6613\u3002<\/p>\n<h3>Cake \u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b cron \u30b8\u30e7\u30d6\u524d\u8ff0<\/h3>\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[CAKE] \u306f CAKE_CORE_INCLUDE_PATH\/cake<br \/>\n\u203b[VENDERS] \u306f CAKE_CORE_INCLUDE_PATH\/vendors<br \/>\n\u203b[ROOT] \u306f ROOT<br \/>\n\u203b[APP] \u306f APP_DIR<\/p>\n<p>\u8a73\u3057\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u306f\u4e0b\u8a18\u306e\u300c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u300d\u3092\u53c2\u7167\u3002<br \/>\n<a href=\"https:\/\/memo.cute.bz\/cakephp\/?p=10\" class=\"note\">\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/p>\n<p>URL\u3078\u306e\u30a2\u30af\u30bb\u30b9\u306b\u3088\u308b\u51e6\u7406\u3092 cron \u3067\u5b9f\u884c\u3059\u308b\u5834\u5408\u306e\u51e6\u7406\u3092\u4e0b\u8a18\u3092\u53c2\u7167\u306e\u3053\u3068\u3002<br \/>\n<a href=\"https:\/\/memo.cute.bz\/cakephp\/?p=8\" class=\"note\">cron \u30b8\u30e7\u30d6<\/a><\/p>\n<h3>\u30b7\u30a7\u30eb\u30d5\u30a1\u30a4\u30eb \u3092\u4f5c\u6210<\/h3>\n<p>[VENDORS]\/shells\/ \u914d\u4e0b\u306b cron.sh \u3092\u4f5c\u6210<br \/>\n\u203b\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u4efb\u610f<\/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 &#x5B;CAKE]\/console\/cake.php $2 $3 $4 -app &#x5B;ROOT]\/$1\r\n\r\n#\u74b0\u5883\u306b\u3088\u3063\u3066\u4e0b\u8a18\u3067\u3082\u53ef\r\n#\/usr\/bin\/php ~\/lib\/cake\/console\/cake.php $2 $3 $4 -app ~\/app\/$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<h4>\u5f15\u6570<\/h4>\n<p>$1 \uff1a \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\uff08[APP]\uff09<br \/>\n$2 \uff1a \u30b7\u30a7\u30eb\u540d\uff08\u30d5\u30a1\u30a4\u30eb\u540d\u3001Shell \u3092\u9664\u3044\u305f\u30af\u30e9\u30b9\u540d\u3068\u540c\u540d\uff09<br \/>\n$3 \uff1a \u30a2\u30af\u30b7\u30e7\u30f3\u540d\uff08\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u540d\uff09<br \/>\n$4 \uff1a \u5f15\u6570\uff08\u7701\u7565\u3082\u53ef\u3002\u8907\u6570\u3042\u308b\u5834\u5408\u306f\u3001$5\u3001$6 \u3068\u5897\u3084\u3059\uff09<\/p>\n<h3>Shell \u30af\u30e9\u30b9\u306e\u4f5c\u6210<\/h3>\n<p>[ROOT]\/[APP]\/vendors\/shells\/ \u914d\u4e0b\u306b exsample.php \u3092\u4f5c\u6210\u3002<br \/>\n\u203b\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u4efb\u610f\u3002<\/p>\n<p>exsample.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\nclass ExsampleShell extends Shell{\r\n\tvar $uses = array('Model'); \/\/ \u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u30e2\u30c7\u30eb\u540d\u3092\u8a18\u8ff0\r\n\r\n\tfunction action() {\r\n\t\t\/\/ \u51e6\u7406\u5185\u5bb9\uff08\u7701\u7565\uff09\r\n\r\n\t\t\/\/ \u53c2\u8003\uff11\r\n\t\t\/\/ Controller \u3068\u540c\u69d8\u306b\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002\r\n\t\t$this-&gt;Model-&gt;find('all');\r\n\r\n\t\t\/\/ \u53c2\u8003\uff12\r\n\t\t\/\/ \u5f15\u6570\u306f $this-&gt;args \u306b\u914d\u5217\u3067\u683c\u7d0d\u3055\u308c\u308b\u3002\r\n\t\t$arg0 = $this-&gt;args&#x5B;0];\r\n\t\t$arg1 = $this-&gt;args&#x5B;1];\r\n\t}\r\n}\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 [\u30a2\u30d7\u30b1\u30fc\u30b7\u30e7\u30f3\u540d] [\u30b7\u30a7\u30eb\u540d\uff08\u30d5\u30a1\u30a4\u30eb\u540d\uff09] [\u30a2\u30af\u30b7\u30e7\u30f3\u540d] [\u5f15\u6570...]<\/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 [\u30a2\u30d7\u30b1\u30fc\u30b7\u30e7\u30f3\u540d] [\u30b7\u30a7\u30eb\u540d\uff08\u30d5\u30a1\u30a4\u30eb\u540d\uff09] [\u30a2\u30af\u30b7\u30e7\u30f3\u540d] [\u5f15\u6570...] >\/dev\/null 2>&1\r\n<\/pre>\n<p>\u203b\u3053\u3053\u3067 [VENDORS] \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<p>\u203b\u4f8b<\/p>\n<pre>\r\n\u5206 \u6642 \u65e5 \u6708 \u66dc\u65e5\r\n1 * * * *\r\nlib\/vendors\/shells\/cron.sh app example action param >\/dev\/null 2>&1\r\n<\/pre>\n<h3>\u53c2\u8003<\/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><br \/>\n<a href=\"http:\/\/d.hatena.ne.jp\/yuhei_kagaya\/20080730\/1217421386\" class=\"note\">CakePHP1.2\u306eShell\u3068Task\u3092\u4f7f\u3063\u3066\u307f\u308b\u3002 &#8211; yuhei.kagaya<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229\u7528\u3057\u305f cron \u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306e\u65b9\u6cd5\u3002 cron \u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u65b9\u6cd5\u3068\u3057\u3066\u3001\u4efb\u610f\u306e URL \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u51e6\u7406\u3059\u308b\u65b9\u6cd5\u3068 Shell \u30af\u30e9\u30b9\uff08Cake \u30b3\u30de\u30f3\u30c9\uff09\u3092\u5229\u7528 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-libs"],"_links":{"self":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/posts\/13","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=13"}],"version-history":[{"count":0,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/memo.cute.bz\/cakephp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}