Initial resurrection kit — 81 scripts, 62 references, configs, systemd units, crons, Docker compose files, Caddy config, master README
This commit is contained in:
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Send home router backup archive via SMTP."""
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.application import MIMEApplication
|
||||
import sys
|
||||
import os
|
||||
|
||||
pw = open("/root/.config/himalaya/g-germainebrown.pass").read().strip()
|
||||
|
||||
archive_path = "/root/.hermes/backups/home-router_20260703.tar.gz"
|
||||
|
||||
msg = MIMEMultipart()
|
||||
msg["From"] = "g@germainebrown.com"
|
||||
msg["To"] = "g@germainebrown.com"
|
||||
msg["Subject"] = "Home Router Backup"
|
||||
|
||||
body = MIMEText(
|
||||
"Attached: home MikroTik backup export (terse config + log + system info).\n"
|
||||
"Router: CCR2004-16G-2S+ (7.18.2)\n"
|
||||
f"Archive size: {os.path.getsize(archive_path) / 1024:.1f} KB\n"
|
||||
)
|
||||
msg.attach(body)
|
||||
|
||||
with open(archive_path, "rb") as f:
|
||||
att = MIMEApplication(f.read(), _subtype="gzip")
|
||||
att.add_header("Content-Disposition", "attachment", filename="home-router_20260703.tar.gz")
|
||||
msg.attach(att)
|
||||
|
||||
with smtplib.SMTP("mail.germainebrown.com", 2525) as s:
|
||||
s.starttls()
|
||||
s.login("g@germainebrown.com", pw)
|
||||
s.send_message(msg)
|
||||
|
||||
print("Email sent successfully")
|
||||
Reference in New Issue
Block a user