Skip to content

Instantly share code, notes, and snippets.

@leozc
Last active September 11, 2015 08:48
Show Gist options
  • Save leozc/5adeda14ce8ee6a85cc0 to your computer and use it in GitHub Desktop.
Save leozc/5adeda14ce8ee6a85cc0 to your computer and use it in GitHub Desktop.
Sample PHP-FPM workers
from subprocess import call
import subprocess
import json
import time
repeat = 30
print '{\"result\":['# header
for x in range(repeat):
p = subprocess.Popen(["curl", 'http://localhost/php_fpm_status?json&full'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
print out
if x < repeat -1:
print ","
time.sleep(2)
print "]}" #tail
@leozc
Copy link
Author

leozc commented Sep 11, 2015

run with
python /tmp/a.py >/tmp/out

and
see the result
cat /tmp/out |python -m json.tool|less

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment