From f40af2cea18562cf84eb97fa76fa34028da6da8d Mon Sep 17 00:00:00 2001 From: remittor Date: Thu, 18 Nov 2021 20:59:21 +0300 Subject: [PATCH] Fix download syslog --- read_dmesg.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/read_dmesg.py b/read_dmesg.py index a4ebccf..d1e85f5 100644 --- a/read_dmesg.py +++ b/read_dmesg.py @@ -28,7 +28,6 @@ print("File {} created!".format(fn_remote)) print("Downloading data to a computer...") gw.download(fn_remote, fn_local) -#print("Удаляю временные файлы") gw.run_cmd("rm -f " + fn_remote) with open(fn_local, "r") as file: @@ -45,12 +44,15 @@ if os.path.exists(fn_local): if os.path.exists(fn_old): os.remove(fn_old) os.rename(fn_local, fn_old) -#gw.run_cmd("cat /data/usr/log/messages > " + fn_remote) -gw.run_cmd("cat /proc/xiaoqiang/xq_syslog > " + fn_remote) + +gw.run_cmd("cat /data/usr/log/messages /tmp/messages > " + fn_remote) +#gw.run_cmd("cat /proc/xiaoqiang/xq_syslog > " + fn_remote) gw.download(fn_remote, fn_local) gw.run_cmd("rm -f " + fn_remote) + with open(fn_local, "r") as file: data = file.read() with open(fn_local, "w") as file: file.write(data) + print("System logs are written to a file {}".format(fn_local))