linux shell之redis命令行及批处理

xingyun86 2019-7-15 1363

#!/bin/sh
host=10.0.3.252
port=6379
pass=''
dbno=1
access_token=$1
access_token_len=$(expr length $access_token)
pass_len=$(expr length $pass)
echo $access_token,$access_token_len,$pass_len
if [ "$access_token_len" -ne 0 ]
then
/usr/local/bin/redis-cli -h $host -p $port -n $dbno hset "minikv2:sync" "access_token" $access_token
current=`date "+%Y-%m-%d %H:%M:%S"`  
timeStamp=`date -d "$current" +%s`  
#将current转换为时间戳,精确到毫秒  
currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000)) 
echo $currentTimeStamp
/usr/local/bin/redis-cli -h $host -p $port -n $dbno hset "minikv2:sync" "access_token_time" $currentTimeStamp
fi
#/usr/local/bin/redis-cli -h $host -p $port -a $password -n $dbnum hset minikv2:sync-token %1
#cat command.txt | /usr/local/redis/bin/redis-cli -h $host -p $port -a $password --pipe


×
打赏作者
最新回复 (0)
只看楼主
全部楼主
返回