Bash One-Liner: Retry Laravel Failed Jobs, Filtered by Date

Aug 17, 2017

We all have those moments when Queue jobs fail. Sometimes it’s a bad deploy,
others it’s an upstream service that’s taken a poop. Sometimes, we need to
retry failed jobs, but can’t just artisan queue retry:all, because maybe we
haven’t done a cleanup of failed jobs lately.

In my case today, I was running some maintenance jobs overnight, when I
overworked a legacy database and caused about ~2500 of 1m+ jobs to timeout.
Not a big problem, but the jobs needed to be retried.

A colleague watching me do it, informed me that last time they did something like this
(I sincerely hope it wasn’t 2500 failed jobs) they typed all the numbers in manually!