modifique el script de cloduflare ddns api
This commit is contained in:
parent
b8f468919b
commit
c40beb6c69
60
.obsidian/workspace.json
vendored
60
.obsidian/workspace.json
vendored
@ -4,19 +4,17 @@
|
||||
"type": "split",
|
||||
"children": [
|
||||
{
|
||||
"id": "fde13488811b0507",
|
||||
"id": "9e4184639eca25d5",
|
||||
"type": "tabs",
|
||||
"children": [
|
||||
{
|
||||
"id": "5181fd5921c9308a",
|
||||
"id": "e1876ef494005bf6",
|
||||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "video",
|
||||
"state": {
|
||||
"file": "Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Grabación 2025-08-01 125909.mp4"
|
||||
},
|
||||
"type": "empty",
|
||||
"state": {},
|
||||
"icon": "lucide-file",
|
||||
"title": "Grabación 2025-08-01 125909"
|
||||
"title": "Nueva pestaña"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -51,7 +49,7 @@
|
||||
"state": {
|
||||
"type": "search",
|
||||
"state": {
|
||||
"query": "",
|
||||
"query": "clou",
|
||||
"matchingCase": false,
|
||||
"explainSearch": false,
|
||||
"collapseAll": false,
|
||||
@ -72,11 +70,13 @@
|
||||
"title": "Marcadores"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"currentTab": 1
|
||||
}
|
||||
],
|
||||
"direction": "horizontal",
|
||||
"width": 458.5
|
||||
"width": 458.5,
|
||||
"collapsed": true
|
||||
},
|
||||
"right": {
|
||||
"id": "3135a52cf6a285ff",
|
||||
@ -166,8 +166,27 @@
|
||||
"command-palette:Abrir paleta de comandos": false
|
||||
}
|
||||
},
|
||||
"active": "db862854e8b7e53a",
|
||||
"active": "e1876ef494005bf6",
|
||||
"lastOpenFiles": [
|
||||
"Agencia_Espacial_Mexicana/DDNS RASTREO CON CLOUDFLARE.md",
|
||||
"DIX_Cluster.canvas",
|
||||
"Otras_varias/Jellyfin en ubuntu server 24.04.md",
|
||||
"Otras_varias/Notificaciones con ntfy.sh.md",
|
||||
"Otras_varias/Servidor SAMBA.md",
|
||||
"Otras_varias/Pagos Jesús.md",
|
||||
"Otras_varias/SSL red local con HAProxy.md",
|
||||
"Otras_varias/Visualización carga de trabajo servers.md",
|
||||
"Bash_functions/Script_sincronizar_obsidian.md",
|
||||
"Bash_functions/ip_device.md",
|
||||
"Bash_functions/custon_name_machine.md",
|
||||
"trabajar_script_mc_backup.md",
|
||||
"Raspberry Pi as Router Wireguard Client.md",
|
||||
"notas express personal.md",
|
||||
"Distribución servicios en las RP.md",
|
||||
"Transcribir Videos (WSL).md",
|
||||
"94BA0000",
|
||||
"~$servers.xlsm",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Grabación 2025-08-01 125909.mp4",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/Introducción a la Administración Pública Federal.md",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Constancia_intro_APF_David_Itehua_Xalamihua.pdf",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Pasted image 20250801164816.png",
|
||||
@ -183,37 +202,18 @@
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Pasted image 20250801160951.png",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Pasted image 20250801160929.png",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Pasted image 20250801160811.png",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos/Grabación 2025-08-01 125909.mp4",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación/Introducción a la Administración Pública Federal/adjuntos",
|
||||
"DIX_Cluster.canvas",
|
||||
"Agencia_Espacial_Mexicana/Cursos_Capacitación",
|
||||
"Distribución servicios en las RP.md",
|
||||
"notas express personal.md",
|
||||
"Transcribir Videos (WSL).md",
|
||||
"SERVERS - DIX/SERVERS DIX.md",
|
||||
"SERVERS - DIX/adjuntos",
|
||||
"SERVERS - DIX",
|
||||
"~$servers.xlsm",
|
||||
"trabajar_script_mc_backup.md",
|
||||
"Configuración Hostinger.md",
|
||||
"Raspberry Pi as Router Wireguard Client.md",
|
||||
"Udemy_Cursos/Curso n8n Crea Agentes de IA sin Código con Make y Zapier/2. zapier.md",
|
||||
"Udemy_Cursos/Curso n8n Crea Agentes de IA sin Código con Make y Zapier/1. Intro Agentes de IA.md",
|
||||
"Udemy_Cursos/Uploads.md",
|
||||
"Bash_functions/Script_sincronizar_obsidian.md",
|
||||
"RCLONE Y DRIVE/SINCRONIZAR DRIVE Y UN VPS.md",
|
||||
"Agencia_Espacial_Mexicana/Transparencia/Sobre Transparencia.md",
|
||||
"Servidor Minecraft/Crear un servidor de Minecraft Java Edition (versión 1.21.5).md",
|
||||
"Agencia_Espacial_Mexicana/Reuniones/PTAR_15-07-2025/Notas de la reunión.md",
|
||||
"Agencia_Espacial_Mexicana/INSTALAR TESSERACT-OCT.md",
|
||||
"Agencia_Espacial_Mexicana/trabajo tmp/del_06.07.2025 Análisis de Viabilidad Financiera del Museo de Telecomunicaciones.md",
|
||||
"Bash_functions/custon_name_machine.md",
|
||||
"Bash_functions/ip_device.md",
|
||||
"Bash_functions/dix_zip.md",
|
||||
"Agencia_Espacial_Mexicana/trabajo tmp/Sin título.md",
|
||||
"Otras_varias/Add User Ubuntu with sudo properties.md",
|
||||
"trabajo tmp/08.07.2025 Análisis de Viabilidad Financiera del Museo de Telecomunicaciones.md",
|
||||
"Sin título 3.canvas",
|
||||
"Sin título 2.canvas",
|
||||
"Sin título 1.canvas"
|
||||
|
@ -140,4 +140,69 @@ fi
|
||||
# echo "[$(date '+%Y-%m-%d %H:%M:%S')] Fin de ejecución."
|
||||
```
|
||||
|
||||
**integra ntfy, que llegue un mensaje cuando cambie la ip**
|
||||
**integra ntfy, que llegue un mensaje cuando cambie la ip**
|
||||
|
||||
|
||||
==MEJORADO, CON PROXIED FALSE==
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
|
||||
# Configuración
|
||||
ZONE_ID="e70540b388ab9d20bfe27d9a31cd474b"
|
||||
RECORD_ID="5d05a48c9d76c7767302442fffa096bd"
|
||||
API_TOKEN="9BD-GB7PtGd5pgXTEBxnv3k1eJlJYJoIWx9HgLLs"
|
||||
DOMAIN="ip.xala.dev"
|
||||
|
||||
|
||||
# Obtener IP pública actual
|
||||
IP=$(curl -s https://api.ipify.org)
|
||||
|
||||
# Obtener IP registrada actualmente en Cloudflare
|
||||
DNS_RECORD=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$RECORD_ID" \
|
||||
-H "Authorization: Bearer $API_TOKEN" \
|
||||
-H "Content-Type: application/json")
|
||||
|
||||
DNS_IP=$(echo "$DNS_RECORD" | jq -r '.result.content')
|
||||
|
||||
# validaciones
|
||||
if [ -z "$IP" ]; then
|
||||
# Notificación vía ntfy
|
||||
# curl -d "🌎 [$(date '+%Y-%m-%d %H:%M:%S')] IP actualizada: $DNS_IP → $IP" ntfy.xala.dev/alerts
|
||||
curl -d "🚨 [$(date '+%Y-%m-%d %H:%M:%S')] No se pudo obtener la IP pública." ntfy.xala.dev/alerts
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$IP" != "$DNS_IP" ]; then
|
||||
curl -d "🌐 La IP ha cambiado: $DNS_IP → $IP. Actualizando en Cloudflare..." ntfy.xala.dev/alerts
|
||||
|
||||
UPDATE_RESPONSE=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$RECORD_ID" \
|
||||
-H "Authorization: Bearer $API_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data "{
|
||||
\"type\": \"A\",
|
||||
\"name\": \"$DOMAIN\",
|
||||
\"content\": \"$IP\",
|
||||
\"ttl\": 1,
|
||||
\"proxied\": false
|
||||
}")
|
||||
|
||||
SUCCESS=$(echo "$UPDATE_RESPONSE" | jq -r '.success')
|
||||
|
||||
if [ "$SUCCESS" == "true" ]; then
|
||||
curl -d "🌎 [$(date '+%Y-%m-%d %H:%M:%S')] IP actualizada: $DNS_IP → $IP" ntfy.xala.dev/alerts
|
||||
else
|
||||
curl -d "🚨 [$(date '+%Y-%m-%d %H:%M:%S')] Falló la actualización en Cloudflare." ntfy.xala.dev/alerts
|
||||
fi
|
||||
else
|
||||
echo "ℹ️ [$(date '+%Y-%m-%d %H:%M:%S')] La IP no ha cambiado: $IP"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
11/02/2025 10,000
|
||||
17/03/2025 7,500
|
||||
30/03/2025 1,000
|
||||
17/07/2025 16,500
|
||||
|
||||
60,000 - 18,500 = 41,500
|
||||
60,000 - 18,500 = 25,000
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user