Skip to content

Instantly share code, notes, and snippets.

@hjr3
Created January 25, 2012 18:09
Show Gist options
  • Save hjr3/1677655 to your computer and use it in GitHub Desktop.
Save hjr3/1677655 to your computer and use it in GitHub Desktop.
Examples of using the gearman tool to create boilerplate clients and workers
# gearman client that sends no data to the "ping" function
gearman -f ping -s
# gearman client that sends the string "pong" to the "ping" function
echo "pong" | gearman -f ping
# gearman client that sends a json string to the "process" function
echo '{"order":4985343}' | gearman -f process
# gearman client that reads data from a order.json file
# and sends to the "process" function
gearman -f ping < order.json
# gearman worker listening for "resize" function
gearman -w -f "resize"
# gearman worker listening for "generate_po" function and exiting after 5 jobs
gearman -w -f generate_po -c 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment