摘要: from multiprocessing import Pool import os,time def Foo(i): time.sleep(2) print("in process",os.getpid()) return i +100 def Bar(arg): print('-->exec done',arg,os.getpid()) if __na... 阅读全文
posted @ 2018-06-25 20:52 努力乄小白 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #!/bin/bash # This script run at 00:00 # The Nginx logs path logs_path="/data0/logs/nginx"#nginx存放日志路径 cd $logs_path#进入到nginx日志下面 mkdir -p ${logs_path}/$(date -d "yesterday" +"%Y%m")#创建日志日期目录 for l... 阅读全文
posted @ 2018-06-25 12:34 努力乄小白 阅读(735) 评论(0) 推荐(0) 编辑
摘要: pipe.py#多进程数据传递接收和发送(类似socket) manger.py#多进程之间数据共享和传递(同时修改一份数据) 阅读全文
posted @ 2018-06-24 22:32 努力乄小白 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 一、程序介绍 需求: 程序结构: 二、流程图 三、代码 目录结构: from_windows.py(待上传的文件) main.py(批量主机管理接口) core.py(核心代码,被接口调用) settings.py(配置文件) View Code 测试: 硬件限制,我只用连接一台虚拟机测试~ 上传前 阅读全文
posted @ 2018-06-22 10:19 努力乄小白 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 客户端实例: 阅读全文
posted @ 2018-06-21 17:42 努力乄小白 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 队列最主要的两个作用: 1.解耦(松耦合) 2.提高效率 阅读全文
posted @ 2018-06-21 17:25 努力乄小白 阅读(168) 评论(0) 推荐(0) 编辑
摘要: import time import threading event =threading.Event() def lighter(): count=0 event.set()#先设置成绿灯 while True: if count >5 and count10: event.set()#变绿灯 count=... 阅读全文
posted @ 2018-06-21 13:57 努力乄小白 阅读(210) 评论(0) 推荐(0) 编辑
摘要: import threading,time def run(n): print("task is ",n) time.sleep(2) print("task done", n) start_time =time.time() t_objs = []#存线程实例 for i in range(50): t = threading.Thread(target=r... 阅读全文
posted @ 2018-06-18 14:36 努力乄小白 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 多线程并行运行的 #启动多个线程实例并行: 阅读全文
posted @ 2018-06-15 14:51 努力乄小白 阅读(98) 评论(0) 推荐(0) 编辑
摘要: import paramiko private_key = paramiko.RSAKey.from_private_key_file('id_rsa.txt') #创建ssh对象 ssh =paramiko.SSHClient() #允许连接不在know_host文件中的主机 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy) #... 阅读全文
posted @ 2018-06-13 23:46 努力乄小白 阅读(325) 评论(0) 推荐(0) 编辑