S
S
smileonl2013-03-16 17:02:38
PHP
smileonl, 2013-03-16 17:02:38

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

5 answer(s)
A
Andrey Shiryaev, 2013-03-16
@smileonl

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.

R
Rowdy Ro, 2013-03-16
@rowdyro

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

S
smartfin, 2013-03-16
@smartfin

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

S
Skpd, 2013-03-16
@Skpd

You can fork 2 times in a php script and get a process that is untethered from the console.

S
sandrain, 2013-11-22
@sandrain

Supervisord had glitches with a large number of workers, so be careful
Proof

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question