dqwolwst50489 2015-10-06 07:01
浏览 37

在CPanel Laravel中设置CronJob

i set up a cronjob in cpanel, i'm using laravel 4.2. i also set to send the cronjob to my email and below yellow part is the error i received in email.

[InvalidArgumentException]

There are no commands defined in the "user" namespace.

//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),
    );
}

}

//command in cpanel

* * * * * /usr/bin/php /home/project/public_html/artisan user:active > /home/project/public_html/log.txt

what's wrong? what's the error mean?

UPDATED

thanks to @KristianHareland i use wget. :)

  • 写回答

1条回答 默认 最新

  • drzrdc1766788 2015-10-06 07:13
    关注

    I think you forget to add this command to artisan app/start/artisan.php.

    You shoud wright:

    Artisan::add(new CronDelFilesCommand());
    

    And don't forget about composer dump-autoload More info you can find here.

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算