fix: files not copied
feat: adjusted example data fix: missing libs in req.txt
This commit is contained in:
parent
38f456516e
commit
2fec02b219
|
|
@ -1,5 +1,5 @@
|
||||||
MAIL_SERVER=mail.mailone24.de
|
MAIL_SERVER=mail.server.de
|
||||||
MAIL_USER=management@oceanwave018.de
|
MAIL_USER=your@mail.de
|
||||||
MAIL_PASSWORD=
|
MAIL_PASSWORD=
|
||||||
MAIL_PORT=587
|
MAIL_PORT=587
|
||||||
EMAIL_RECEIVER=sr.strangas@gmail.com
|
EMAIL_RECEIVER=reciever@mail.de
|
||||||
|
|
@ -14,7 +14,7 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||||
RUN apt-get update && apt-get install -y cron
|
RUN apt-get update && apt-get install -y cron
|
||||||
|
|
||||||
# Add the cron job to run the Python script weekly (every Sunday at 3 AM)
|
# Add the cron job to run the Python script weekly (every Sunday at 3 AM)
|
||||||
RUN echo "*/5 * * * * /usr/local/bin/python3 /usr/src/app/main.py >> /var/log/cron.log 2>&1" > /etc/cron.d/weekly_job
|
RUN echo "0 11 * * 0 /usr/local/bin/python3 /usr/src/app/main.py >> /var/log/cron.log 2>&1" > /etc/cron.d/weekly_job
|
||||||
|
|
||||||
# Give execution rights on the cron job
|
# Give execution rights on the cron job
|
||||||
RUN chmod 0644 /etc/cron.d/weekly_job
|
RUN chmod 0644 /etc/cron.d/weekly_job
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
python-cron-job:
|
python-cron-job:
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
container_name: python-cron-job
|
container_name: python-cron-job
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./app:/usr/src/app # Mount your local app directory to the container
|
- ./services.json:/usr/src/app/services.json # Mount your local app directory to the container
|
||||||
environment:
|
environment:
|
||||||
- TZ=UTC # Set the timezone (you can adjust this as needed)
|
- TZ=UTC # Set the timezone (you can adjust this as needed)
|
||||||
logging:
|
logging:
|
||||||
|
|
|
||||||
6
main.py
6
main.py
|
|
@ -2,6 +2,7 @@ import json
|
||||||
import requests
|
import requests
|
||||||
import os
|
import os
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import pathlib
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
|
@ -129,6 +130,7 @@ def send_email(status_dict, server, user, password, receiver):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with smtplib.SMTP(server, port=os.getenv("MAIL_PORT")) as smtp:
|
with smtplib.SMTP(server, port=os.getenv("MAIL_PORT")) as smtp:
|
||||||
|
smtp.connect(server, os.getenv("MAIL_PORT"))
|
||||||
smtp.starttls()
|
smtp.starttls()
|
||||||
smtp.login(user, password)
|
smtp.login(user, password)
|
||||||
smtp.sendmail(user, receiver, message.as_string())
|
smtp.sendmail(user, receiver, message.as_string())
|
||||||
|
|
@ -148,7 +150,9 @@ def main():
|
||||||
receiver = os.getenv("EMAIL_RECEIVER")
|
receiver = os.getenv("EMAIL_RECEIVER")
|
||||||
|
|
||||||
# Load services and check their status
|
# Load services and check their status
|
||||||
services = load_services("./services.json")
|
cwd = pathlib.Path(__file__).parent.resolve()
|
||||||
|
print("%s/services.json"%cwd)
|
||||||
|
services = load_services("%s/services.json"%cwd)
|
||||||
status_dict = {url: check_service_status(url) for url in services}
|
status_dict = {url: check_service_status(url) for url in services}
|
||||||
|
|
||||||
print(status_dict)
|
print(status_dict)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
certifi==2024.8.30
|
certifi==2024.8.30
|
||||||
charset-normalizer==3.3.2
|
charset-normalizer==3.3.2
|
||||||
idna==3.8
|
idna==3.8
|
||||||
|
pathlib==1.0.1
|
||||||
python-dotenv==1.0.1
|
python-dotenv==1.0.1
|
||||||
requests==2.32.3
|
requests==2.32.3
|
||||||
urllib3==2.2.2
|
urllib3==2.2.2
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
[
|
[
|
||||||
"https://brunnergarten-muc.de/",
|
"https://another.your-domain.de",
|
||||||
"https://cms.brunnergarten-muc.de/",
|
"https://your-domain.de"
|
||||||
"https://nextcloud.oceanwave018.de/",
|
|
||||||
"https://hilfe.oceanwave018.de/",
|
|
||||||
"https://traefik.oceanwave018.de/"
|
|
||||||
]
|
]
|
||||||
Loading…
Reference in New Issue