0

I want to have Beansalkd workers in BASH script, not in PHP like you usually see. Is that possible?

Everywhere I look, the Beanstalkd workers are PHP scripts. So what I want is: after beanstalkd starts up, you can add worker jobs in it which wait for jobs. A job is an HTTP request to do some intensive processing. For this I can use PHP to put the job into the beanstalkd queue. But the actual workers that do the jobs, are BASH scripts.

For example, in Gearman it's possible to specify workers and their function names, and what they must do once a job comes in, like run a BASH script.

John
  • 39
  • 4
  • Have you looked through this? https://github.com/beanstalkd/beanstalkd/wiki/Client-Libraries -> No BASH, but other libs may help you understand how to use BASH w/ it. Or, write your own custom solution. – B. Shea Mar 09 '21 at 14:50
  • I have seen that, and as I understand: it's not possible to have a beanstalk PHP client and a worker in another language. I just want to run a few Linux commands when a job comes in. – John Mar 09 '21 at 14:59
  • Sorry, not very familiar with beanstalkd. Have you considered `shell_exec()` or `exec()` under the php 'worker'? https://www.php.net/manual/en/function.shell-exec.php Example for a script: https://stackoverflow.com/a/15704183/503621 – B. Shea Mar 12 '21 at 11:29
  • I think there will be too much overhead. PHP is used by my webserver to serve web pages, I'm using PHP-FPM, and there is a max amount of PHP processes configured. What if there will be too much website visitors? That means there won't be enough processes to run the beanstalkd worker PHP scripts. – John Mar 12 '21 at 12:36

0 Answers0