Remove command output txt file on c-wrapper start

pull/9/head
Jeremiah K 2023-11-27 19:32:40 -06:00
rodzic 6e3e3ea4e3
commit 3efb6be74d
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -2,10 +2,15 @@ import os
import subprocess
import time
output_file = '/home/mesh/app/command_output.txt'
flag_file = '/home/mesh/app/.commands_executed'
# Remove the output file if it exists
if os.path.exists(output_file):
os.remove(output_file)
def log_to_file(message):
with open('/home/mesh/app/command_output.txt', 'a') as f:
with open(output_file, 'a') as f:
f.write(message + "\n")
def execute_meshtastic_command(options):
@ -36,4 +41,4 @@ else:
# Create the flag file to indicate that all commands have been executed.
with open(flag_file, 'w') as f:
f.write("Commands executed on: " + time.ctime())
break
break