更新 monitor.py
parent
e2f0186d07
commit
ff3e9a7aae
|
|
@ -44,7 +44,7 @@ def str_to_timestamp(time_str):
|
||||||
format_str = "%Y-%m-%d %H:%M:%S"
|
format_str = "%Y-%m-%d %H:%M:%S"
|
||||||
try:
|
try:
|
||||||
dt_object = datetime.strptime(time_str,format_str)
|
dt_object = datetime.strptime(time_str,format_str)
|
||||||
timestamp = dt_object.timestamp()
|
timestamp = int(dt_object.timestamp())
|
||||||
return timestamp
|
return timestamp
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
logging.error(f"str_to_timestamp error: {e}")
|
logging.error(f"str_to_timestamp error: {e}")
|
||||||
|
|
@ -70,7 +70,7 @@ def monitor(device):
|
||||||
diff_timestamp = now_timestamp - last_line_timestamp
|
diff_timestamp = now_timestamp - last_line_timestamp
|
||||||
print(f"diff_timestamp: {diff_timestamp},与上次成功获取任务时间差{int(diff_timestamp/60)}分钟")
|
print(f"diff_timestamp: {diff_timestamp},与上次成功获取任务时间差{int(diff_timestamp/60)}分钟")
|
||||||
logging.info(f"{device}与上次成功获取任务时间差{int(diff_timestamp/60)}分钟")
|
logging.info(f"{device}与上次成功获取任务时间差{int(diff_timestamp/60)}分钟")
|
||||||
time_difference = modules.read_config.read_time_difference()
|
time_difference = int(modules.read_config.read_time_difference());
|
||||||
if diff_timestamp >= time_difference:
|
if diff_timestamp >= time_difference:
|
||||||
success = modules.command.restart_ProxyMe(device)
|
success = modules.command.restart_ProxyMe(device)
|
||||||
if success:
|
if success:
|
||||||
|
|
|
||||||
Reference in New Issue