From 2d39083ec3bf023e4adb1d2ac02cbaefd422b613 Mon Sep 17 00:00:00 2001 From: Marc Mance Date: Tue, 27 Aug 2024 19:01:52 -0400 Subject: [PATCH] added cleanCSV --- collect.py | 14 +++++++++++++- readme.org | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/collect.py b/collect.py index 00db243..1a3e565 100644 --- a/collect.py +++ b/collect.py @@ -330,7 +330,18 @@ def run_debug(): print(f"Error running midclt debug: {e}") return None +def cleanCSV(): + if is_debian(): + dir = "/var/log/proftpd" + if is_freebsd(): + dir = "/var/log" + + for filename in os.listdir(dir): + name = filename.absolute() + if filename.endswith(".csv"): # Check for .csv extension + os.remove(name) + def collect_csv(): source_dir = os.getcwd() @@ -506,7 +517,8 @@ def main(): # Upload data (replace with credentials and actual upload logic if needed) upload_debug() - + cleanCSV() + print("Data collection and upload completed.") diff --git a/readme.org b/readme.org index 36c4bc4..81ae2f1 100644 --- a/readme.org +++ b/readme.org @@ -256,3 +256,7 @@ ziostat = [ Data collection and upload completed. root@m40g2-124a[~/statscollect]# #+end_src + +#+begin_src shell + python3 collect.py 5 2 +#+end_src