added cleanCSV

This commit is contained in:
Marc Mance
2024-08-27 19:01:52 -04:00
parent cb448cc1fb
commit 2d39083ec3
2 changed files with 17 additions and 1 deletions

View File

@@ -330,6 +330,17 @@ 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,6 +517,7 @@ def main():
# Upload data (replace with credentials and actual upload logic if needed)
upload_debug()
cleanCSV()
print("Data collection and upload completed.")

View File

@@ -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