{"id":1754,"date":"2020-05-22T11:05:49","date_gmt":"2020-05-22T02:05:49","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=1754"},"modified":"2021-01-14T12:02:49","modified_gmt":"2021-01-14T03:02:49","slug":"post-1754","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2020\/05\/22\/post-1754\/","title":{"rendered":"Cron\u306fRunning\u306a\u306e\u306bCrontab\u306b\u66f8\u3044\u305f\u5b9a\u6642\u5b9f\u884c\u304c\u52d5\u304b\u306a\u304b\u3063\u305f\u7406\u7531"},"content":{"rendered":"<h2>Cron\u306fRunning\u306a\u306e\u306bCrontab\u306b\u66f8\u3044\u305f\u5b9a\u6642\u5b9f\u884c\u304c\u52d5\u304b\u306a\u304b\u3063\u305f\u7406\u7531<\/h2>\n<p>\u3053\u3093\u306a\u5834\u9762\u306b\u906d\u9047\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u6163\u308c\u3066\u304d\u305f\u304b\u3089\u8d77\u3053\u308b\u30dd\u30ab\u3068\u3044\u3046\u304b\u7406\u89e3\u4e0d\u8db3\u3068\u3044\u3046\u304b\u3002<br \/>\n\u539f\u56e0\u306f\u8d85\u7c21\u5358\u306a\u6240\u3060\u3063\u305f\u306e\u3067\u3001\u6b21\u56de\u306e\u70ba\u306e\u5099\u5fd8\u9332\u3067\u3059\u3002<\/p>\n<h3>Docker\u3092\u30ea\u30d3\u30eb\u30c9\u3057\u305f\u3089Laravel\u306eScheduler\u304c\u52d5\u304b\u306a\u304f\u306a\u3063\u305f<\/h3>\n<p>\u5207\u3063\u639b\u3051\u306fDocker\u306e\u30ea\u30d3\u30eb\u30c9\u3002<br \/>\n\u6628\u65e5\u66f8\u3044\u305f\u8a18\u4e8b\u306e\u901a\u308a\u3001\u30b5\u30b8\u30a7\u30b9\u30c8\u3092\u5927\u91cf\u306b\u53d6\u5f97\u3059\u308b\u30e2\u30fc\u30c9\u3082\u7528\u610f\u3057\u305f\u3044\u3068\u601d\u3044Docker\u3092\u518d\u69cb\u7bc9\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u7d50\u679c\u3001\u30b5\u30b8\u30a7\u30b9\u30c8\u306f\u610f\u56f3\u3057\u305f\u3068\u304a\u308a\u306b\u52d5\u3044\u305f\u308f\u3051\u3067\u3059\u304c\u3001\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u53ce\u3081\u3066\u3044\u305fRanking\u53d6\u5f97\u3068\u304b\u4ed6\u5e97\u58f2\u4fa1\u53d6\u5f97\u304c\u52d5\u4f5c\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u3002<br \/>\n\u539f\u56e0\u8ffd\u53ca\u306e\u70ba\u3001\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u8abf\u67fb\u3057\u307e\u3057\u305f\u3002<\/p>\n<div class=\"borderBox\">\n<ul>\n<li>crontab -e \uff1a\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u304c\u3061\u3083\u3093\u3068\u767b\u9332\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/li>\n<li>service cron status \uff1acron is running \u304c\u8fd4\u3063\u3066\u304d\u307e\u3059\u3002<\/li>\n<li>(Project\u306b\u79fb\u52d5\u3057\u3066\uff09php artisan schedule:run \uff1aNo scheduled commands are ready to run.\u3068\u6012\u3089\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n<\/div>\n<p>\u3053\u306e\u7d50\u679c\u3092\u53d7\u3051\u3066Laravel\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306e\u65b9\u306e\u554f\u984c\u3068\u5224\u65ad\u3057\u3066\u3057\u307e\u3063\u305f\u306e\u304c\u4eca\u56de\u306e\u6700\u5927\u306e\u30df\u30b9\u3067\u3057\u305f\u3002<\/p>\n<h3>\u6b63\u3057\u304f\u3066\u3082\u300eNo scheduled commands are ready to run.\u300f\u306f\u51fa\u308b<\/h3>\n<p>\u5b9f\u306f\u30d7\u30ed\u30b0\u30e9\u30e0\u81ea\u4f53\u306b\u9593\u9055\u3044\u304c\u7121\u304f\u3066\u3082\u300cNo scheduled commands are ready to run.\u300d\u3068\u3044\u3046\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u51fa\u73fe\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u300c\u4eca\u52d5\u304f(\u6e96\u5099\u3059\u3079\u304d)\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306f\u306a\u3044\u3088\u300d\u3068\u8a00\u3046\u4e8b\u306a\u306e\u3067\u3001\u4f8b\u3048\u3070\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u304c\u6bce\u6642\u5b9f\u884c\u3067\u7d44\u307e\u308c\u3066\u3044\u305f\u5834\u5408\u3010\u4eca\u3011\u52d5\u304b\u3059\u5974\u304c\u3044\u306a\u3044\u306e\u3067\u3010No scheduled commands are ready to run.\u3011\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f55\u304b\u306e\u30df\u30b9\u3067\u52d5\u304b\u306a\u3044\u306e\u304b\u3001\u305d\u308c\u3068\u3082\u305f\u3060\u5358\u306b\u8a08\u753b\u6642\u9593\u306b\u9054\u3057\u3066\u3044\u306a\u3044\u306e\u304b\u306e\u5224\u65ad\u306f\u6bce\u5206\u5b9f\u884c\u306b\u5909\u66f4\u3057\u3066schedule:run \u3092\u53e9\u304f\u4e8b\u3067\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u25a0File\uff1aapp\/Console\/Kernel.php<\/p>\n<pre class=\"lang:default decode:true\">&lt;?php\r\nnamespace App\\Console; \r\n\r\nuse DB; \r\nuse Illuminate\\Console\\Scheduling\\Schedule;\r\nuse Illuminate\\Foundation\\Console\\Kernel as ConsoleKernel; \r\nuse Illuminate\\Support\\Facades\\Log;\r\n\r\nclass Kernel extends ConsoleKernel\r\n{\r\n    protected $commands = [\r\n        (\u4e2d\u7565) \r\n        \\App\\Console\\Commands\\schedules\\loging::class\r\n    ];\r\n    protected function schedule(Schedule $schedule)\r\n    {\r\n        $schedule-&amp;gt;command('command:loging')-&amp;gt;everyMinute();\r\n        (\u4e2d\u7565)\r\n    }\r\n(\u5f8c\u7565)<\/pre>\n<p>\u25a0File\uff1aapp\/Console\/Commands\/loging.php<\/p>\n<pre class=\"lang:default decode:true \">&lt;?php\r\n\r\nnamespace App\\Console\\Commands\\schedules;\r\n\r\nuse Illuminate\\Console\\Command;\r\nuse Illuminate\\Support\\Facades\\Log;\r\n\r\nclass loging extends Command\r\n{\r\n    protected $signature = 'command:loging {--secret=}';\r\n    protected $description = '\u30c6\u30b9\u30c8\u7528\u30b9\u30b1\u30b8\u30e5\u2015\u30eb\u30ed\u30b0';\r\n\r\n    public function __construct()\r\n    {\r\n        parent::__construct();\r\n    }\r\n\r\n    public function handle()\r\n    {\r\n        Log::info('TEST\u3067\u3059\u3002');\r\n    }\r\n}<\/pre>\n<p>-&gt;everyMinute();\u3068\u3057\u3066\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u767b\u9332\u3057\u3001\u305d\u306e\u4e0a\u3067 php artisan schedule:run \u3092\u5b9f\u884c\u3059\u308b\u3068\u30b3\u30de\u30f3\u30c9\u304c\u52d5\u304f\u5834\u5408\u3001\u554f\u984c\u306e\u7b87\u6240\u306fLaravel Scheduler \u306b\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h3>cron is running \u3067\u3082 crontab\u3092\u898b\u3066\u3044\u308b\u3068\u306f\u9650\u3089\u306a\u3044<\/h3>\n<p>\u4eca\u56de\u306e\u4e00\u756a\u306e\u5931\u6557\u306fcron is running \u3092\u898b\u305f\u77ac\u9593\u3001cron\u306e\u554f\u984c\u3067\u306f\u306a\u3044\u3068\u5224\u65ad\u3057\u3066\u3057\u307e\u3063\u305f\u4e8b\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u306f\u30bf\u30a4\u30c8\u30eb\u306e\u901a\u308a\u3001CRON\u304c\u8d70\u3063\u3066\u3044\u3066\u3082CRONTAB\u3092\u307f\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u306a\u306e\u3067\u3010service cron restart\u3011\u306e\u5b9f\u884c\u3067\u5f93\u6765\u901a\u308aLaravelSchedule\u304c\u5b9f\u884c\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>cron \u304c crontab\u3092\u898b\u3066\u3044\u306a\u304b\u3063\u305f\u7406\u7531<\/h3>\n<p>\u4eca\u56de\u4f5c\u6210\u3057\u305fDocker\u3067\u306f\u3001OS\u3092\u542b\u3080WEB\u30b5\u30fc\u30d3\u30b9\u3092Dockerfile\u306b\u8a18\u8f09\u3057\u3001docker-compose.yml\u3067crontab\u306e\u8a2d\u5b9a\u3084LaravelProject\u3092\u8a2d\u7f6e\u3057\u307e\u3057\u305f\u3002Cron\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u8d77\u52d5\u306e\u6307\u793a\u306fDockerfile\u5185\u306b\u3001\u3042\u308a\u3069\u3046\u3084\u3089\u3053\u308c\u304c\u554f\u984c\u3060\u3063\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<p>docker-compose.yml\u306b\u3066WEB\u30b5\u30fc\u30d3\u30b9\u306b\u767b\u9332\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u9054\u306fDockerfile\u3092\u5b9f\u884c\u3057\u305f\u5f8c\u306b\u9069\u7528\u3055\u308c\u308b\u3002<br \/>\n\u3060\u304b\u3089Cron\u3092\u8d77\u52d5\u3057\u305f\u6642\u70b9\u3067crontab\u306f\u7a7a\u3063\u307d\u3002<\/p>\n<\/div>\n<p>\u52d5\u3044\u3066\u3044\u308bCRON\u306b\u306fcrontab\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001LaravelScheduler\u306e\u5b9f\u884c\u3092\u3057\u306a\u304b\u3063\u305f\u308f\u3051\u3067\u3059\u3002<br \/>\n\u306a\u308b\u307b\u3069\u3001\u8d77\u52d5\u306e\u9806\u756a\u304b\u3002<\/p>\n<h3>cron\u30b5\u30fc\u30d3\u30b9\u306e\u30ea\u30b9\u30bf\u30fc\u30c8\u3067\u89e3\u6c7a<\/h3>\n<pre class=\"lang:default decode:true \">crontab -e<\/pre>\n<p>\u3053\u308c\u3067\u767b\u9332\u3057\u305fLaravel\u306eschedule:run\u3092\u767b\u9332\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u3066\u304f\u308c\u3070\u30ea\u30b9\u30bf\u30fc\u30c8\u3060\u3051\u3067\u8ab2\u984c\u89e3\u6c7a\u3067\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">$ service cron restart\r\n\r\n * Restarting periodic command scheduler cron                                   \r\n * Stopping periodic command scheduler cron                              [ OK ]\r\n * Starting periodic command scheduler cron                              [ OK ]<\/pre>\n<p>\u3044\u3084\u3041\uff5e\u3053\u3053\u307e\u3067\u6765\u308b\u306e\u9577\u304b\u3063\u305f...\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u6163\u308c\u3066\u304f\u308b\u3068\u30c4\u30a4\u30c4\u30a4\u3053\u3046\u3044\u3063\u305f\u3010\u9806\u756a\u3011\u3092\u898b\u843d\u3068\u3057\u3066\u7d30\u304b\u3044\u9593\u9055\u3044\u306b\u76ee\u3092\u3084\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u307e\u3067\u8d77\u3053\u3089\u306a\u304b\u3063\u305f\u3088\u3046\u306a\u4e8b\u6848\u304c\u767a\u751f\u3059\u308b\u306e\u306f\u5f53\u305f\u308a\u524d\u306e\u30d1\u30fc\u30c8\u304c\u758e\u304b\u306b\u306a\u3063\u3066\u3057\u307e\u3063\u305f\u304b\u3089\u306a\u3093\u3067\u3059\u3088\u306d\u3002<\/p>\n<p>\u6c17\u3092\u5f15\u304d\u7de0\u3081\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cron\u306fRunning\u306a\u306e\u306bCrontab\u306b\u66f8\u3044\u305f\u5b9a\u6642\u5b9f\u884c\u304c\u52d5\u304b\u306a\u304b\u3063\u305f\u7406\u7531 \u3053\u3093\u306a\u5834\u9762\u306b\u906d\u9047\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 \u6163\u308c\u3066\u304d\u305f\u304b\u3089\u8d77\u3053\u308b\u30dd\u30ab\u3068\u3044\u3046\u304b\u7406\u89e3\u4e0d\u8db3\u3068\u3044\u3046\u304b\u3002 \u539f\u56e0\u306f\u8d85\u7c21\u5358\u306a\u6240\u3060\u3063\u305f\u306e\u3067\u3001\u6b21\u56de\u306e\u70ba\u306e\u5099\u5fd8\u9332\u3067\u3059\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1502,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[34],"tags":[64,645,644,153,643,98,646,648,53,647,45,68],"class_list":["post-1754","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-memorandum","tag-api","tag-cron","tag-crontab","tag-laravel","tag-no-scheduled-commands-are-ready-to-run","tag-php","tag-schedulerun","tag-648","tag-53","tag-647","tag-45","tag-68"],"veu_head_title_object":{"title":"","add_site_title":""},"jetpack_publicize_connections":[],"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2020\/02\/https___www.creationline.com_wp-content_uploads_2018_06_Moby2018.png","_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=1754"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1754\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/1502"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=1754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=1754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=1754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}