notebook
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Prida obri slozky (Odstranena/Dorucena posta) do checkpointu - prijimame je
|
||||
jako hotove na ~99%, protoze re-scan 170k/47k hlavicek deterministicky wedgne
|
||||
MailStore IMAP. Data uz v Mongu jsou z drivejsich behu."""
|
||||
import paramiko
|
||||
GIANTS = [
|
||||
"vladimir.buzalka@buzalka.cz/Exchange vladimir.buzalka/Odstraněná pošta",
|
||||
"vladimir.buzalka@buzalka.cz/Exchange vladimir.buzalka/Doručená pošta",
|
||||
]
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("192.168.1.76", username="root", password="7309208104", timeout=10)
|
||||
sftp = c.open_sftp()
|
||||
path = "/mnt/user/Scripts/MailStore/ingest_done.txt"
|
||||
# nacti stavajici
|
||||
with sftp.open(path, "r") as f:
|
||||
existing = {ln.strip() for ln in f.read().decode("utf-8").splitlines() if ln.strip()}
|
||||
added = 0
|
||||
with sftp.open(path, "a") as f:
|
||||
for g in GIANTS:
|
||||
if g not in existing:
|
||||
f.write(g + "\n")
|
||||
added += 1
|
||||
print("pridano:", g)
|
||||
else:
|
||||
print("uz tam je:", g)
|
||||
print("celkem pridano:", added)
|
||||
sftp.close(); c.close()
|
||||
Reference in New Issue
Block a user