erikhamrin's avatar

Sail - schedule:run not triggering command set to runInBackground

I'm on Laravel 11 on a Linux machine and have encountered an issue.

In my Console/Kernel I define the following:

$schedule->command('activity_log:clean --count=10')
			->everyMinute()
			->runInBackground();

All my command does is logging "Cleanup start" to a log file. But it's not executing when running sail artisan schedule:run

Running the command using sail artisan activity_log:clean --count=10 works just fine.

Running the scheduler without ->runInBackground() works fine too.

The output of sail artisan schedule:run is

 2024-11-19 15:30:06 Running ['artisan' activity_log:clean --count=10] in background ....... 25.79ms DONE
  ⇂ ('/usr/bin/php8.2' 'artisan' activity_log:clean --count=10 > '/dev/null' 2>&1 ; '/usr/bin/php8.2' 'artisan' schedule:finish "framework/schedule-90ccb27aa92ffa3de188b29f68ec34630ba46a95" "$?") > '/dev/null' 2>&1 &  

It all looks correct, and using sail bash and running the command from inside sail works as expected.

Any idea why sail schedule:run doesn't trigger the command?

0 likes
0 replies

Please or to participate in this conversation.