Daemon that monitors a 'queue' and runs commands, asynchronously <p>I know this has been asked before, but I can't figure out a particular piece of the puzzle and would really like any help on this!</p> <p><strong>Program Flow :</strong> </p> <p><em>INITIAL REQUEST :</em> Browser -> Apache -> to PHP -> PHP sends taskinfo about a time consuming command, to 'something', and returns instantly.</p> <p>There could be multiple requests being sent at the same time to the server, by multiple browsers.</p> <p><em>SERVER:</em> The 'something' runs a specific command with the taskinfo as params PARALLELY in the BACKGROUND > saves output to DB</p> <p><em>AJAX:</em> -> Apache -> PHP -> Checks DB -> Returns info to user.</p> <p>I have explored solutions such as rabbitmq / gearman etc, but am unable to figure them out. </p> <p>The <strong>precise problem</strong> is that I can't figure out the part where the 'something' (a daemon), automatically runs the specified command, whenever a task in added to a 'queue/list'. The way I see it, a command needs to run seperate from the daemon, and I don't understand where or how this command should run.</p> <p>So in short: A non-blocking daemon that monitors a queue and runs a specific command! </p> <p>But How ?</p> <p>Been stuck at this for a few days now. I know there are simpler alternatives like curl and exec(), but they are not suitable for my use case.</p> <p>Thanks</p>