#TIL : Gearman bash worker and client
Gearman is a awesome job queue service that helps you scale your system. In smaller context, it can help us to run a background woker for minor tasks like backup data, cleaning system.
$ sudo apt install gearman-job-server gearman-tools
Create a worker bash script
#!/bin/bash echo $1 echo $2
-w means run as worker mode ,
-f test means function name will be
$ chmod +x worker.sh $ gearman -w -f test xargs ./worker.sh
$ gearman -f test "hello" "hogehoge"
Sending background job
$ gearman -b -f test "hello" "hogehoge"