ADD front as Server

This commit is contained in:
sebastian.serfling
2024-08-29 12:47:29 +02:00
parent cafee6032c
commit 5b236148c2
7 changed files with 140 additions and 16 deletions
+20 -6
View File
@@ -3,11 +3,12 @@ import csv
import os
import requests
import socket
import subprocess
from pathlib import Path
csvfile = Path("user.csv")
host = "127.0.0.1"
host = "front"
port = 993
@@ -35,14 +36,27 @@ except FileNotFoundError:
rows = []
with open(csvfile, mode='r', newline='') as file:
reader = csv.reader(file, delimiter=";")
next(reader)
for row in reader:
rows.append(row)
for row in rows:
print(len(rows))
print(row[0])
print(row[1])
username = row[0]
password = row[1]
domain = row[2]
# Erstellen einer Liste für den Befehl und die Argumente
command = [
"imapsync",
"--host1", domain,
"--user1", username,
"--password1", password,
"--host2", "front",
"--user2", "archiv@archiv.trendsetzer.eu",
"--port2","143",
"--password2", "S8jZT7Ke3gdzxV0QfsB19R1bNwR716M6yUJQ4az9Kr8EK"
# "--prefix2", f"Archiv/{username}/", # Verwende dynamisch den username im Zielordner
# "--regextrans2", "s/^(.*)$/\\${1}/",
]
subprocess.run(command)
# CSV laden
# User in CSV kontrollieren ob vorhanden -> User anlegen