import os
l = ['ssh a;scp /data/visitlog/*11* root@d:/data/mapReduceVisitorLog/'] # b c
for i in l:
os.system(i)
在执行py脚本前,配置好了免密登录;
python this_.py
成功登录到a服务器,但是剩下的不能执行;
实现思路:
事件触发机制;
各个节点 http 监听;收到后执行命令;
import os
sh_, nodes = 'ssh A "scp /data/visitlog/* root@d:/data/mapReduceVisitorLog/A/"', ['a', 'b', 'c']
for i in nodes:
s = sh_.replace('A', i)
os.system(s)
python 执行 python 文件
import os
sh_, nodes = 'ssh A "scp /data/visitlog/* root@d:/data/mapReduceVisitorLog/A/"', ['a', 'b', 'c']
for i in nodes:
s = sh_.replace('A', i)
os.system(s)
os.system('python mapReduceBatchDeleteLoopDate20180101-20200101.py')
os.system('python mapReduceBatchDeleteLoopDateDealLog20180101-20200101.py')