[英]Set Up CronJob In CPanel Laravel
我在cpanel中设置了cronjob,我使用的是laravel 4.2。 我还设置将cronjob发送到我的电子邮件,黄色部分下方是我在电子邮件中收到的错误。
[InvalidArgumentException]
在“用户”名称空间中没有定义任何命令。
// laravel command.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class CronDelFilesCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'user:active';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
echo "aaa";
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}
}
// cpanel中的命令
* * * * * /usr/bin/php /home/project/public_html/artisan user:active > /home/project/public_html/log.txt
怎么了? 错误是什么意思?
更新
感谢@KristianHareland我使用wget。 :)
我想您忘了将此命令添加到artisan app/start/artisan.php
。
你应该赖特:
Artisan::add(new CronDelFilesCommand());
并且不要忘记composer dump-autoload
更多信息,您可以在这里找到。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.