Ask the PHP script to run forever, access the queue

See also Having a PHP script loop that forever performs calculations from the queue system , but this does not answer all my questions.

If I want to run a PHP script forever, calling the queue and completing tasks:

  • What are the potential memory problems? How to avoid them? (any flash functions or something that I should use?)

  • What if the script dies for some reason? What would be a good way to automatically start it again?

  • What is the best basic approach for running a script. Since it works forever, I don't need cron. But how do I get started? (See also 2.)

+5
source share
3 answers

cron script. 10 . script, (,.lock). , . , .lock . - , / , .lock . , .

, , PHP script , . , .., script - .

+9

PHP ( ) MQ, , MQ .

MQ ( ruby, perl,.NET, java ..) concurrency, , , .

+1

, , "" (: flv2avi), "" (flv2avi 1.flv).

script (Perl), script. , , script , ; , . 1-2 , .

:   (- )   ( , )   , , "",   .

(vlc | ffmpeg, tail -f | grep), - , fork() ( PHP?) /bin/ bash -c "prog1 | prog2", .

: /etc/rc.d, cron ( , || 'debug')

0

All Articles