|
@@ -17,7 +17,7 @@ def run_command(cmd, logfile):
|
|
|
|
|
|
|
|
|
def task_scheduler(logfile):
|
|
|
- run_command("schtasks /query /v /fo CSV", logfile)
|
|
|
+ run_command('schtasks /query /v /fo CSV | find ".bat"', logfile)
|
|
|
|
|
|
|
|
|
def task_manager(logfile):
|
|
@@ -43,12 +43,12 @@ def datasources_all_models(cfg: config.Config):
|
|
|
model_datasources(cfg, model_file, cfg.tasks_dir + "\\config\\models\\" + model_file.name + ".log")
|
|
|
|
|
|
|
|
|
-def database_info(cfg: config.Config):
|
|
|
+def database_info(cfg: config.Config, csv_file):
|
|
|
dbinfo = DatabaseInfo()
|
|
|
result = []
|
|
|
for db in dbinfo.databases():
|
|
|
result.extend(dbinfo.table_size(db[0]))
|
|
|
- csv_file = cfg.tasks_dir + "\\logs\\db_info.csv"
|
|
|
+
|
|
|
with open(csv_file, "w", encoding="latin-1", newline="") as fwh:
|
|
|
wr = csv.writer(fwh, delimiter=";")
|
|
|
wr.writerow(
|
|
@@ -78,29 +78,33 @@ def zip_to_file(base_dir, zip_file):
|
|
|
zip.write(e, e.relative_to(base_dir))
|
|
|
|
|
|
|
|
|
-if __name__ == "__main__":
|
|
|
+def main():
|
|
|
cfg = config.Config()
|
|
|
|
|
|
# Aufgabenplanung aktueller Stand
|
|
|
- task_scheduler(cfg.tasks_dir + "\\logs\\schtasks.csv")
|
|
|
+ task_scheduler(cfg.log_dir + "\\schtasks.csv.log")
|
|
|
# Laufende Prozesse
|
|
|
- task_manager(cfg.tasks_dir + "\\logs\\tasklist.csv")
|
|
|
+ task_manager(cfg.log_dir + "\\tasklist.csv.log")
|
|
|
# aktuelle Freigabe-Sessions
|
|
|
- shared_files(cfg.tasks_dir + "\\logs\\openfiles.csv")
|
|
|
+ shared_files(cfg.log_dir + "\\openfiles.csv.log")
|
|
|
# Tabellengrößen
|
|
|
- database_info(cfg)
|
|
|
+ database_info(cfg, cfg.log_dir + "\\db_info.csv.log")
|
|
|
|
|
|
- datasources_all_models(cfg)
|
|
|
+ # datasources_all_models(cfg)
|
|
|
# Liste aller Dateien im GAPS-Verzeichnis
|
|
|
# filename;size;cdate;mdate
|
|
|
ti = PathInfo()
|
|
|
ti.check_dir(cfg.portal_dir)
|
|
|
- ti.write_logfile(cfg.tasks_dir + "\\logs\\path_info.csv")
|
|
|
+ ti.write_logfile(cfg.log_dir + "\\path_info.csv.log")
|
|
|
|
|
|
# Logdateien aus Tasks/logs und System/prot
|
|
|
timestamp = datetime.now().strftime("%Y-%m-%d_%H%M%S")
|
|
|
- zip_file = f"{cfg.tasks_dir}\\logs\\{cfg.kunde_safe}_{timestamp}.zip"
|
|
|
+ zip_file = f"{cfg.tasks_dir}\\logs\\zip\\{cfg.kunde_safe}_{timestamp}.zip"
|
|
|
zip_to_file(cfg.tasks_dir, zip_file)
|
|
|
|
|
|
# Upload auf FTP
|
|
|
FtpClient().upload(zip_file)
|
|
|
+
|
|
|
+
|
|
|
+if __name__ == "__main__":
|
|
|
+ main()
|