File: test_ws_redis.sh

package info (click to toggle)
opencpn 1%3A5.10.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 164,172 kB
  • sloc: ansic: 515,707; cpp: 353,066; xml: 84,559; sh: 5,343; python: 1,833; makefile: 101; perl: 83; cs: 65; javascript: 65; ruby: 21
file content (25 lines) | stat: -rw-r--r-- 479 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

# Handle Ctrl-C by killing all sub-processing AND exiting
trap cleanup INT

function cleanup {
    kill `cat /tmp/pidfile.subscribe`
    exit 1
}

REDIS_HOST=${REDIS_HOST:=localhost}

ws redis_subscribe --pidfile /tmp/pidfile.subscribe --host $REDIS_HOST foo &

# Wait for the subscriber to be ready
sleep 0.5

# Now publish messages
ws redis_publish -c 100000 --host ${REDIS_HOST} foo bar

# Wait a little for all messages to be received
sleep 1.5

# Cleanup
cleanup