added cleanCSV
This commit is contained in:
12
collect.py
12
collect.py
@@ -330,6 +330,17 @@ 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,6 +517,7 @@ 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.")
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user