Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iaibai's avatar

Scheduled commands stop running after deployment

I wonder if anyone has any ideas about this problem I'm having with deployment to Elastic Beanstalk?

I've got a Command that's scheduled to run every minute. It normally takes about 45 seconds, and I've scheduled it using:

    ->everyMinute()
    ->onOneServer()
    ->runInBackground()
    ->withoutOverlapping(10); 

We're using withoutOverlapping because although it should run every minute, on rare occasions it takes longer and we don't want it to overlap.

The issue is that if the command is running during a deployment, it then won't run again for 10 minutes. After that it runs every minute as expected. It seems that Laravel is preventing an overlap, even though I can see from our logs that the command did actually finish.

I can see from "ps aux" when the command is running that it looks like this; sh -c ('/usr/bin/php' 'artisan' mycommand:command > '/dev/null' 2>&1 ; '/usr/bin/php' 'artisan' schedule:finish "framework/schedule-a839ecc42aed78e0646ec2cc1c7c1f0b6273d64b" "$?") > '/dev/null' 2>&1 &

So I'm wondering if there's some reason that "php artisan schedule:finish" isn't successfully marking the command as complete, or something along those lines?

Thanks for any suggestions

0 likes
1 reply
iaibai's avatar

Some more information here. I manually edited the Laravel code on the server, so that the command run looked like this;

sh -c ('/usr/bin/php' 'artisan' mycommand:command > '/dev/null' 2>&1 ; '/usr/bin/php' 'artisan' schedule:finish "framework/schedule-a839ecc42aed78e0646ec2cc1c7c1f0b6273d64b" "$?") > '/var/log/testlog.log' 2>&1 &

And the contents of testlog.log after a deploy are; "Could not open input file: artisan"

So it seems like whatever directory the command is initially run in, doesn't exist at the end. Possibly due to a sym link switch or something like this. I'll need to investigate further.

Please or to participate in this conversation.