Answer the question
In order to leave comments, you need to log in
Gearman running in the background
Hello.
The second day I'm torturing Gearman in conjunction with php. Everything is cool, but there is one thing that interests me.
I want it to process tasks in the background, that is.
Now, in order to work out the task, you need to run the worker and it hangs on the command line.
It is required to start and close the command line, but the worker should continue to work.
Tried to output to /dev/null but it doesn't work.
What's the best way to do it?
Is it mandatory to use supervisord??? Or are there better options?
Answer the question
In order to leave comments, you need to log in
Runit (but this is an analogue of supervisord), it’s very easy to launch in one line, it can keep a log, run processes from the user, in case of a process crash, raise it, replace init.d scripts. As far as I remember, it is written in C and there are a minimum of resources.
For me, all german's workers work like this
/usr/bin/php worker.php 2>&1 > /var/log/worker.log &
run in the service script, and there is a guard in the cron that monitors processes by pid file
1) you can run a worker with cron, and build in it a check for the number of running workers based on pid files.
2) supervisor
3) Alternatively, if working on a remote server, use screen / tmux
You can fork 2 times in a php script and get a process that is untethered from the console.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question