| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Handle Ctrl-C by killing all sub-processing AND exiting |
| 4 |
trap cleanup INT |
| 5 |
|
| 6 |
function cleanup { |
| 7 |
kill `cat /tmp/pidfile.subscribe` |
| 8 |
exit 1 |
| 9 |
} |
| 10 |
|
| 11 |
REDIS_HOST=${REDIS_HOST:=localhost} |
| 12 |
|
| 13 |
ws redis_subscribe --pidfile /tmp/pidfile.subscribe --host $REDIS_HOST foo & |
| 14 |
|
| 15 |
# Wait for the subscriber to be ready |
| 16 |
sleep 0.5 |
| 17 |
|
| 18 |
# Now publish messages |
| 19 |
ws redis_publish -c 100000 --host ${REDIS_HOST} foo bar |
| 20 |
|
| 21 |
# Wait a little for all messages to be received |
| 22 |
sleep 1.5 |
| 23 |
|
| 24 |
# Cleanup |
| 25 |
cleanup |