Mimmo
Mimmo

Reputation: 123

Laravel 4 - command in shared hosting cron job

i've developed a simply new command by using

php artisan command:make MyCommand

and after, i've registered it in app/start/artisan.php in this way

Artisan::add('MyCommand');

i've no problem to call command locally by

php artisan command:MyCommand

but i've errors when i try to call the command by using a cron job the cron job is done in this way

/usr/bin/php -c /usr/local/apache/conf/userdata/std/2/dferdinw/php.ini /home2/dferdinw/public_html/ff4b/artisan command:MyCommand

but i receive this error

[InvalidArgumentException] 
Command "command:MyCommand" is not defined. 
Did you mean this? 
command:make 

Any idea???

Upvotes: 2

Views: 370

Answers (1)

Brian
Brian

Reputation: 351

Update

If this is working locally and not on your server then check to see if your files are updated on your server.


Seems like if it works from the command line it should work from Cron. Try adding

echo __DIR__; 

to the fire method and run it again manually it verify you've got the right DIR.

If it's not working from the command line make sure you named your command by changing the

protected $name = 'command:MyCommand';

The generator does NOT fill this out for you.

Also try

Artisan::add(new MyCommand);

And run

php artisan dump-autoload

For you cron job try

cd /home2/dferdinw/public_html/ff4b/; php artisan command:MyCommand;

Upvotes: 1

Related Questions