def force_kill(): self.stopEverything() ###force #find out pid for java.exe with red5 arguments red5_pid = myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe") if len(red5_pid): self.vcdx.killprocess(red5_pid) pass
def check_netstat(): time.sleep(3) pids = myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe") if len(pids)>0: self.vcdx.log("Exists stream server") self.btn_stopMedia_server.setEnabled(True) else: self.vcdx.log("Not found stream server") self.menu_item_red5_start_Action.setEnabled(True) self.btn_stopMedia_server.setEnabled(False) pass
def verify_servers4livestream(self): #check red5 server for ready red5_pid = myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe") #check ffmpeg stream ffmpeg_pids = myFuncs.get_pid_by_name("ffmpeg.exe") #check nginx server for ready nginx = myFuncs.get_pid_by_name("nginx.exe") #make sure server, livestream, nginx are working return {"red5":len(red5_pid), "ffmpeg": len(ffmpeg_pids), "nginx": len(nginx)}
def stop_red5_server(self): red5_pid = myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe") if len(red5_pid)==0: self.log("not found red5 running") return #dont slient output on cmd.exe, by leave default stdout, change also for stdin,stderr since we use py2exe to deploy app #set slient output out,in,error: Popen("your-command", stdin=PIPE, stdout=PIPE, stderr=PIPE) startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW p = Popen([myFuncs.resource_path(':cmd/red5-shutdown.bat'), ''] , startupinfo=startupinfo,stdin=PIPE, stdout=PIPE, stderr=PIPE) #want this task slient #p = Popen(myFuncs.readFileContent(':cmd/red5-shutdown.bat') ,stdin=PIPE, stdout=PIPE, stderr=PIPE) #want this task slient #p.kill() #kill this process output, err = p.communicate() self.log("stop red5 server") if output != None: self.log("console:" + output) #find out pid for java.exe with red5 arguments red5_pid = myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe") if len(red5_pid): self.killprocess(red5_pid) return output pass
def _start_red5(): time.sleep(5) #CHECK for 5 seconds self.btn_startMedia_server.setDisabled(False) #this menu alway enable if len(myFuncs.get_pid_by_commandline("org.red5.server.Bootstrap","java.exe"))==0: self.menu_item_red5_start_Action.setEnabled(True) self.btn_stopMedia_server.setDisabled(True) #myFuncs.msgBox(self,"Error to create stream.") self.vcdx.log ("\nUnable to start Red5, do it again.") #do not call self.log method else: self.menu_item_red5_start_Action.setEnabled(False) self.btn_stopMedia_server.setDisabled(False) self.btn_startMedia_server.setText("Start media server") pass