File: populate_memcached.sh

package info (click to toggle)
nutcracker 0.5.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,192 kB
  • sloc: ansic: 15,221; sh: 5,284; python: 1,230; php: 300; makefile: 130
file content (24 lines) | stat: -rwxr-xr-x 495 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
#!/bin/sh

port=22123
socatopt="-t 1 -T 1 -b 65537"

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

# build
for i in `seq 1 512`; 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"

    printf "%b" "$set_command" | socat ${socatopt} - TCP:localhost:${port},nodelay,shut-down,nonblock=1 &
done