0

I've setup Gearman to work with PHP. Im really new to Gearman and task managing and the problem im having is that, when i close the terminal window running the worker, the process stops too. I want the PHP worker script to run forever. I don't know how to achieve this. Am i missing something from the documentation?

astroanu
  • 3,901
  • 2
  • 36
  • 50

2 Answers2

2

Take a look at Gearman Manager. It's designed to work as a service that you can start / stop. It's installed with install.sh.

/etc/init.d/gearman-manager start
/etc/init.d/gearman-manager stop
brianreavis
  • 11,562
  • 3
  • 43
  • 50
0

In case anybody is interested in a simpler way to handle this. Use a shell script to call the worker.php in a loop. You can also pass variables to the php cli (-rmethod)

#!/bin/bash
while true
do
php -q /path/to/worker.php -rmethod
sleep 5
done

Another way was to use Supervisord. Running Gearman Workers in the Background

Community
  • 1
  • 1
astroanu
  • 3,901
  • 2
  • 36
  • 50