-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathceshi2.0.sh
executable file
·32 lines (27 loc) · 1023 Bytes
/
ceshi2.0.sh
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
30
31
32
#!/bin/bash
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "开始时间:${time}"
# 开始执行
#redis-cli -p 3310 -a password --eval getUnusedData.lua > keys.txt
redisCom="redis-cli -p 3310 -a password"
start=0
fileNamePre="unUseData_"
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "拆分执行 开始时间:${time} 开始索引 ${start}"
data=`${redisCom} --eval getUnusedData2.0.lua , ${start}`
echo ${data} | sed 's/ / \n/g' > "${fileNamePre}""${start}"
start=`echo ${data} | cut -d ' ' -f1`
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "拆分执行 结束时间:${time}"
while(( $start>0 ))
do
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "拆分执行 开始时间:${time} 开始索引 ${start}"
data=`${redisCom} --eval getUnusedData2.0.lua , ${start}`
echo ${data} | sed 's/ / \n/g' > "${fileNamePre}""${start}"
start=`echo ${data} | cut -d ' ' -f1`
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "拆分执行 结束时间:${time}"
done
time=$(date "+%Y-%m-%d %H:%M:%S")
echo "结束时间:${time}"