LoginSignup
10
8

More than 5 years have passed since last update.

Laravelコマンドをcrontabに登録

Last updated at Posted at 2014-04-08

Laravelコマンドをcronに登録する方法をメモ。日本語のサイトが見つけきれなかったので。

Laravelのコマンドは普段こんな感じで実行されていると思う。


php artisan command:test

これを、たとえば毎週月曜0時0分に実行したい場合、
crontabを編集する


vi /etc/crontab

そして、以下を追記する


0 0 * * 1 root /usr/bin/php /your/file/to/path/artisan command:test

ポイントは、

  • php
  • artisan

という何気なく打っているコマンドを絶対パスで指定すること。それだけ。

ちなみにphpの実行ファイルがどこにあるかは


find / -name php

って打てば出てくるはず。

終わり。

10
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
8