-
pika安装 (点我进官网)
-
要插入的数据
任务ID | 平台 | value1 | value2 | value3 |
---|
taska | android | 1 | 2 | 3 |
taskb | ios | 2 | 3 | 4 |
taskc | other | 3 | 4 | 5 |
import subprocess
ssh_command = r"redis-cli -h xx.xxx.xxx.xxx -p xxxxx -a 'xxxxxx'"
input_file = r'/home/xxxxxx/zhangjinke/tasks.txt'
with open(input_file,'r') as file:
file_list = file.readlines()
for i in file_list:
data = i.strip().split('\t')
taskid = data[0]
channel = data[1]
send_pv = data[2]
show_uv = data[3]
open_uv = data[4]
command = r'hmset taskid:' + taskid + '@@' + channel + ' send_pv ' + send_pv + ' show_uv ' + show_uv + ' open_uv ' + open_uv
a = subprocess.call(ssh_command+' '+command,shell=True)
if a==0:
continue
else:
print('更新失败:' + i)