Get it here: http://gist.github.com/174941
Copied here for a Good Reason, probably:
#!/usr/bin/env python
import socket
def uzblctrl(socket_file, input):
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(socket_file)
sock.settimeout(0.5) # 500ms
sock.send(input+'\n')
output = ''
try:
while True:
buflen = 1024*1024 # 1M
buf = sock.recv(buflen)
output += buf
# Don't wait to timeout if we get short output
if len(buf) != buflen: break
except socket.timeout:
pass
sock.close()
if len(output) > 0 and output[-1]: output = output[:-1]
return output
if __name__ == '__main__':
import sys
if len(sys.argv) == 3:
print uzblctrl(sys.argv[1], sys.argv[2])
else:
print 'usage: uzblctrl.py <socket_file> <input>'