What is the correct way to run Symfony tasks in a separate process. My first guess would be to use fork/exec, but according to this, you can’t do it with anything that keeps open file descriptors or connections (like MySQL). So that doesn’t sound like its an option. Another alternative is to do exec('symfony taskname &'), but that seems like a hack. Is that the best I can do? Is there a third way?
What is the correct way to run Symfony tasks in a separate process. My
Share
Here’s how I ended up doing it:
You have to redirect STDOUT, or else it won’t run in the background (though you don’t have to use /dev/null if you want the actual output). In my case I set up all my tasks to use Symfony’s file logger, so it wasn’t an issue.
I’m still looking for a better solution though. This seems like a hack.