This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def log(msg): | |
| try: | |
| timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") | |
| s = "%s %s | |
| " % (timestamp, msg) | |
| f = open(LOG_FILE, "a") | |
| f.write(s) | |
| f.close() | |
| print(s.strip()) | |
| except: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd "/Applications/rentman-monitor" | |
| cat > rentman_repairs.py << 'EOF' | |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import BaseHTTPServer | |
| import json | |
| import smtplib | |
| import subprocess | |
| import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| okay, så lav lige et helt script igen. med alle de nye opdateringer vi har snakket om. | |
| Her er et samlet, renset script til din gamle macOS (Python 2.7), med: | |
| - Håndtering af Rentman‑webhooks (kun gyldig JSON). [1] | |
| - Filter på `itemType == "Repairs"`. [1] | |
| - Email via SMTP. | |
| - Print via `lp`. | |
| - Simpel logging til `/tmp/rentman_monitor.log`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jeg lavede aldrig log osv som vi snakkede om tidligere. jeg skal bruge noget super let jeg kan copy paste ind i eksisterende script | |
| Her er den absolut korteste log‑tilføjelse du kan copy‑paste ind i dit nuværende script, uden at ændre resten. | |
| ## 1) Lille log‑funktion (øverst i filen) | |
| Åbn filen: | |
| ```bash | |
| cd "/Applications/rentman-monitor" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| python - << 'EOF' | |
| import smtplib | |
| SMTP_SERVER="smtp.gmail.com"; SMTP_PORT=587 | |
| SMTP_USER="din@gmail.com"; SMTP_PASS="DITAPPPASS" | |
| TO_EMAIL="modtager@eksempel.dk" | |
| s = smtplib.SMTP(SMTP_SERVER, SMTP_PORT) | |
| s.starttls() | |
| s.login(SMTP_USER, SMTP_PASS) | |
| s.sendmail(SMTP_USER, TO_EMAIL, "Subject: TEST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find alle andre fejl NU | |
| ## 🔍 **FULD AUDIT - ALLE FEJL FIXES (High Sierra 10.13.6)** | |
| ### **TRIN 1: KOMPLET FEJLFRI SCRIPT (COPY-PASTE)** | |
| ```bash | |
| cd "/Applications/rentman-monitor" | |
| cat > rentman_repairs.py << 'EOF' | |
| #!/usr/bin/python | |
| import BaseHTTPServer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd ~/rentman-monitor | |
| cat > rentman_repairs.py << 'EOF' | |
| #!/Applications/Python 3.9/python | |
| import http.server | |
| import socketserver | |
| import json | |
| import hmac | |
| import hashlib | |
| import smtplib | |
| import subprocess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| python3 command not found? | |
| ## Python3 IKKE installeret? Hurtig fix (2 min) | |
| ### **TRIN 1: Tjek Python status** | |
| ```bash | |
| python3 --version | |
| # ELLER | |
| python --version | |
| ``` |