bin/resend_borg_error.py

25 lines
540 B
Python
Raw Normal View History

2024-11-27 20:17:52 +01:00
# /// script
# dependencies = [
# "resend",
# ]
# ///
2024-09-07 22:39:46 +02:00
2024-09-07 23:07:20 +02:00
import subprocess
2024-11-27 20:17:52 +01:00
from pathlib import Path
import resend
2024-09-07 22:39:46 +02:00
2024-11-27 20:17:52 +01:00
resend.api_key = (
Path("/usr/local/etc/resend_api_key.txt").read_text().strip("\n")
)
2024-09-07 22:39:46 +02:00
params: resend.Emails.SendParams = {
2024-11-27 20:17:52 +01:00
"from": "Borgmatic <admin@hyperreal.coffee>",
"to": ["hyperreal@moonshadow.dev"],
2024-09-09 03:32:21 +02:00
"subject": "[moonshadow] Error running Borgmatic",
"text": "There was an error running your Borgmatic backup on moonshadow. Please investigate.",
2024-09-07 22:39:46 +02:00
}
email = resend.Emails.send(params)
print(email)