简体   繁体   中英

Set Up CronJob In CPanel Laravel

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. :)

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM