elif PLATFORM == "Linux": if self.fileName.endswith("py"): os.system("cd %s && gnome-terminal -- python3 %s" % (DIR, os.path.join(DIR, self.fileName))) else: os.system("cd %s && gnome-terminal -- %s" % (DIR, os.path.join(DIR, self.fileName))) # win32api.ShellExecute(0, 'open', self.fileName, '', '', 1) print('start the target successfully...') outer_starttime = time() if __name__ == '__main__': expired = 3 # 日志文件最大500MB maxSize = 500 # 轮训间隔时间:1分钟 interval = 60 # 建立日志对象 logobj = LogHandler(expired, maxSize, interval) # 启动日志监测线程 logobj.start() # 设置程序死机等待多少秒时间后重启 restartTime = 20 # 需要启动的目标文件名 targetFileName = 'sps' # 设置通信端口号 port = 8889 obj = WatchDog(port, targetFileName, restartTime) obj.waitFood()
def __init__(self, *args, **kwargs): self.log = LogHandler(self.name, file=False) self.response = Response()