Sunday, July 1, 2012

Re: Gearman worker as Console command



On Monday, 25 June 2012 18:17:56 UTC+2, baur79 wrote:
Hi,

is it possable to use Console/cake some_command as Gearman Worker
please suggest some idea?

thanks in advance

Just follow the gearman docs to setup a worker if you want a dedicated gearman worker cli, The linked example on sanisoft is pretty easy to follow if you want a worker to do one thing.

You can also use gearman in worker mode to run arbitrary cake commands:

    cd /an/app/install
    nohup gearman -w -f console -- xargs -0 -i -t sh -c "Console/cake {}" & 

That needs only one daemon to run any console command. Then, anywhere in your code:

    $g = new \GearmanClient();
    $g->addServer();
    $g->doBackground('console', 'bake controller examples'); // requests `Console/cake bake controller examples` to be ran in the background

That can give great flexibility in what things you can send to the background.

AD

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: