MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_last_exec_time

Method get_last_exec_time

mod/project/php/php_asyncMod.py:1494–1518  ·  view source on GitHub ↗

@name 获取上次执行时间 @author hwliang @param log_file 日志文件路径 @return format_date

(self, log_file)

Source from the content-addressed store, hash-verified

1492 return ''
1493
1494 def get_last_exec_time(self, log_file):
1495 '''
1496 @name 获取上次执行时间
1497 @author hwliang
1498 @param log_file<string> 日志文件路径
1499 @return format_date
1500 ''&#x27;
1501 exec_date = ''
1502 try:
1503 log_body = public.GetNumLines(log_file, 20)
1504 if log_body:
1505 log_arr = log_body.split('\n')
1506 date_list = []
1507 for i in log_arr:
1508 if i.find('★') != -1 and i.find('[') != -1 and i.find(']') != -1:
1509 date_list.append(i)
1510 if date_list:
1511 exec_date = date_list[-1].split(']')[0].split('[')[1]
1512 except:
1513 pass
1514
1515 finally:
1516 if not exec_date:
1517 exec_date = public.format_date(times=int(os.path.getmtime(log_file)))
1518 return exec_date
1519
1520 def start_task(self, get):
1521 try:

Callers 1

get_crontab_listMethod · 0.95

Calls 4

GetNumLinesMethod · 0.80
splitMethod · 0.45
findMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected