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,7 +330,18 @@ def run_debug():
print(f"Error running midclt debug: {e}") print(f"Error running midclt debug: {e}")
return None 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(): def collect_csv():
source_dir = os.getcwd() source_dir = os.getcwd()
@@ -506,7 +517,8 @@ def main():
# Upload data (replace with credentials and actual upload logic if needed) # Upload data (replace with credentials and actual upload logic if needed)
upload_debug() upload_debug()
cleanCSV()
print("Data collection and upload completed.") print("Data collection and upload completed.")

View File

@@ -256,3 +256,7 @@ ziostat = [
Data collection and upload completed. Data collection and upload completed.
root@m40g2-124a[~/statscollect]# root@m40g2-124a[~/statscollect]#
#+end_src #+end_src
#+begin_src shell
python3 collect.py 5 2
#+end_src