Support the ongoing development of Laravel.io →
Scheduling Artisan Laravel

hi,
I'm trying to make a laravel 5.4 based softwre work on our ovh shared server and while everything else works fine, the schedule is inoperant, it generates no error but does absolutly nothing.
After some test I narrowed the problem to the schedule->command.
This is a simple test that I made to illustrate the issue, I have the following command(textcommand.php) in Console/Commands :

namespace App\Console\Commands;
use Illuminate\Console\Command;
class testcommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'testcommand';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'just a test';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
			$myfile = fopen(storage_path() . "/testfile.txt", "a");
			$txt = date("Y-m-d h:i:sa") . "\n";
			fwrite($myfile, $txt);
			fclose($myfile);
    }
}

running artisan testcommand will work fine and a date will be written in testfile.txt
then if I create a schedule in the kernel:

$schedule->command('testcommand')
            ->everyMinute()
            ->sendOutputTo(storage_path().'/logs/testcommand.log');

running artisan schedule:run will return Running scheduled command: '/usr/local/php7.4/bin/php' 'artisan' testcommand > '/dev/null' 2>&1 but nothing in testfile.txt, no log in testcommand.log and no laravel log generated, it's like nothing happend at all.

running the command directly in the kernel will work :

		$schedule->call(function () {
			$myfile = fopen(storage_path() . "/testfile.txt", "a");
			$txt = date("Y-m-d h:i:sa") . "\n";
			fwrite($myfile, $txt);
			fclose($myfile);
        })	->everyMinute()
			->sendOutputTo(storage_path().'/logs/custom-test.log');

and

$schedule->exec('export PHP_PATH=/usr/local/php7.4/bin/php; $PHP_PATH artisan testcommand > "/logs/custom-test.log" 2>&1')
            ->everyMinute()
            ->sendOutputTo(storage_path().'/logs/testcommand.log');

wont do anything either.

I suspect the limited ovh hosting to be responsible somewhere as this software works fine on other hosting but the lack of logs and error make the issue hard to spot.
if you have any idea?

erwan

0

Sign in to participate in this thread!

Eventy

Your banner here too?

erwan e-rwan Joined 20 Oct 2022

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.