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?
            Asked
            
        
        
            Active
            
        
            Viewed 624 times
        
    2 Answers
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
 
- 
                    Thank i wrote my own lightweight gearman manager. and this was a good suggestion too – astroanu Jun 10 '14 at 05:18
 
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