Moved checking lastheard.log at program startup

This commit is contained in:
Waldek 2021-01-04 19:42:57 +01:00 committed by GitHub
parent 277b1fc575
commit 1435f19a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 6 deletions

View File

@ -632,11 +632,7 @@ def process_message(_bmessage):
log_lh_message = '{},{},{},{},{},{},{},TS{},TG{},{},{},{}'.format(_now, p[9], p[0], p[1], p[3], p[5], alias_call(int(p[5]), subscriber_ids), p[7], p[8],alias_tgid(int(p[8]),talkgroup_ids),p[6], alias_short(int(p[6]), subscriber_ids))
lh_logfile = open(LOG_PATH+"lastheard.log", "a")
lh_logfile.write(log_lh_message + '\n')
lh_logfile.close()
try:
check_call("sed -i -e 's|\\x0||g' {}".format(LOG_PATH+"lastheard.log"), shell=True)
except CalledProcessError as err:
print(err)
lh_logfile.close()
# Lastheard in Dashboard by SP2ONG
my_list=[]
n=0
@ -833,7 +829,13 @@ if __name__ == '__main__':
logging.info('monitor.py starting up')
logger.info('\n\n\tCopyright (c) 2016, 2017, 2018, 2019\n\tThe Regents of the K0USY Group. All rights reserved.\n\n\tPython 3 port:\n\t2019 Steve Miller, KC1AWV <smiller@kc1awv.net>\n\n\tVersion by:\t SP2ONG 2019-2021\n\n')
# Check lastheard.log file
if os.path.isfile(LOG_PATH+"lastheard.log"):
try:
check_call("sed -i -e 's|\\x0||g' {}".format(LOG_PATH+"lastheard.log"), shell=True)
logging.info('Check lastheard.log file')
except CalledProcessError as err:
print(err)
# Download alias files
result = try_download(PATH, PEER_FILE, PEER_URL, (FILE_RELOAD * 86400))
logging.info(result)