File: pipelined_write.sh

package info (click to toggle)
nutcracker 0.4.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 1,388 kB
  • ctags: 1,493
  • sloc: ansic: 14,328; python: 1,147; sh: 854; makefile: 105
file content (29 lines) | stat: -rwxr-xr-x 639 bytes parent folder | download | duplicates (3)
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
26
27
28
29
#!/bin/sh

socatopt="-t 1 -T 1 -b 16384"

val=`echo 6^6^6 | bc`
val=`printf "%s" "${val}"`
vallen=`printf "%s" "${val}" | wc -c`
set_command=""
set_commands=""

# build
for i in `seq 1 64`; do
    if [ `expr $i % 2` -eq "0" ]; then
        key="foo"
    else
        key="bar"
    fi
    key=`printf "%s%d" "${key}" "${i}"`

    set_command="set ${key} 0 0 ${vallen}\r\n${val}\r\n"
    set_commands=`printf "%s%s" "${set_commands}" "${set_command}"`
done

printf "%b" "$set_commands" > /tmp/socat.input

# write
for i in `seq 1 16`; do
    cat /tmp/socat.input | socat ${socatopt} - TCP:localhost:22123,nodelay,shut-down,nonblock=1 &
done