UsbLogger.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Solo-Mapper 作者: Escadrone 项目源码 文件源码
def run(self):         
       #Every 10s, we check prospective USB-disconnect messages in kern.log            
        while self.goOn:
         with verrou:            
          try:
            checkProcess = subprocess.Popen("sudo tail -n 5 /var/log/kern.log | grep disconnect >> /mnt/Usb-Solo-Mapper/Logs/usbCheck.log", stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)   
            checkProcess.wait()
            usb_file = open("/mnt/Usb-Solo-Mapper/Logs/usbCheck.log", "a")
            usb_file.close()
          except Exception as e:
            self.logger.error('USB check process failed : %s',e)        
          finally:     
            time.sleep(10)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号