1234567891011121314151617181920212223242526272829303132333435363738 |
- '''
- Description:
- Version: 1.0
- Autor: lishengyin
- Date: 2022-01-14 10:11:13
- LastEditors: lishengyin
- LastEditTime: 2022-01-14 14:49:21
- '''
- import time
- import socket
- import os
- def resetMiva():
-
- result = os.popen('pidof main').readlines()
- if len(result):
- Ctime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
- os.popen('echo "' + Ctime + ' MIVA卡死" >> ./watchDog.log')
-
- os.popen('killall main').readlines()
-
- if __name__ == '__main__':
-
- udp_socket_server = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
- udp_socket_server.settimeout(30)
-
- udp_socket_server.bind(("",9527))
-
- try:
- udp_socket_server.settimeout(30)
-
- recv_data,ip_port = udp_socket_server.recvfrom(1024)
- except socket.timeout:
- print("超时没收到")
- resetMiva()
-
- udp_socket_server.close()
|