[email protected] mc]# cat mc.sh
#!/bin/bash
function Random {
mc0= "192.168.8.62 7510"
#MC1 = "192.168.30.22 7510"
Case "$ (expr $ (date +%s%n) \% 2)" in
0)
Mc= "$MC 0"
;;
1)
mc= "$MC 1"
;;
Esac
}
> Set-result.txt
> Get-result.txt
> Delete-result.txt
For ((i=0;i<500;i++))
Do
a=12345
Random
printf "Set kx$i 0 0 5\r\n${a}\r\n" | NC $MC>>set-result.txt
Done
For ((k=0;k<500;k++))
Do
Random
printf "Get kx$k\r\n" | NC $MC| Sed-n ' 2p ' |sed "s/.*/$k &/" >> get-result.txt
Done
For ((j=0;j<500;j++))
Do
Random
printf "Delete kx$j\r\n" | NC $MC>> Delete-result.txt
Done
echo "Setet number:"
grep stored-c Set-result.txt
echo "Get number:"
grep 12345-c Get-result.txt
echo "Delete number:"
grep deleted-c Delete-result.txt
Exit
####
> Get-result.txt
For ((k=1;k<5;k++))
Do
printf "Get kx$k\r\n" | NC 192.168.1.61 11211 | Sed-n ' 2p ' |sed "s/.*/$k &/" >> get-result.txt
Done
echo "Delete then get number:"
grep 12345-c Get-result.txt
Shell Operation Memcache