chore: checkpoint initial — Zektyc dataset, avant humanisation
- site vitrine + fingerprint test + zmap + z-panel - remplacement duckdns -> riricdev.tail5ea5cd.ts.net (canonical/og/alternates/docs) - suppression du token DuckDNS (plus utilisé)
This commit is contained in:
commit
8e7ec41f18
104 changed files with 19256 additions and 0 deletions
64
scripts/uptime-check.sh
Executable file
64
scripts/uptime-check.sh
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
#!/usr/bin/env bash
|
||||
# Zektyc — moniteur de disponibilité (uptime checker)
|
||||
# Vérifie toutes les 5 secondes le code HTTP de réponse de la homepage.
|
||||
# - Code 2xx/3xx -> online
|
||||
# - Code 000 (échec connexion / funnel coupé), 5xx (erreur serveur) ou autre
|
||||
# code d'échec -> incident technique
|
||||
set -uo pipefail
|
||||
|
||||
URL="https://riricdev.tail5ea5cd.ts.net/"
|
||||
WEBHOOK="https://discord.com/api/webhooks/***REMOVED***"
|
||||
STATE_FILE="/home/riricdev/zektyc/scripts/.uptime-state"
|
||||
INTERVAL=5
|
||||
|
||||
# Un code HTTP est "online" s'il est 2xx/3xx, ou 429 (rate limit = serveur up,
|
||||
# juste throttlé). Tout le reste (000, 4xx hors 429, 5xx) = down.
|
||||
http_is_online() {
|
||||
local code="$1"
|
||||
case "$code" in
|
||||
2*|3*|429) return 0 ;; # 200-399 et 429 : online
|
||||
*) return 1 ;; # 000, 4xx (hors 429), 5xx : down
|
||||
esac
|
||||
}
|
||||
|
||||
down() {
|
||||
local payload
|
||||
payload=$(printf '{"content":"🔴 **Zektyc** — incident technique."}' )
|
||||
curl -s -m 10 -H "Content-Type: application/json" -X POST "$WEBHOOK" -d "$payload" >/dev/null 2>&1 || true
|
||||
echo down >"$STATE_FILE"
|
||||
}
|
||||
|
||||
up() {
|
||||
local payload
|
||||
payload=$(printf '{"content":"🟢 **Zektyc** — le site est de nouveau en ligne."}' )
|
||||
curl -s -m 10 -H "Content-Type: application/json" -X POST "$WEBHOOK" -d "$payload" >/dev/null 2>&1 || true
|
||||
echo up >"$STATE_FILE"
|
||||
}
|
||||
|
||||
if [[ ! -f "$STATE_FILE" ]]; then
|
||||
echo "unknown" >"$STATE_FILE"
|
||||
fi
|
||||
|
||||
while true; do
|
||||
code="$(curl -s -o /dev/null -w '%{http_code}' -m 10 "$URL" 2>/dev/null || echo 000)"
|
||||
code="${code:-000}"
|
||||
state="$(cat "$STATE_FILE")"
|
||||
|
||||
if http_is_online "$code"; then
|
||||
if [[ "$state" != "up" ]]; then
|
||||
up
|
||||
fi
|
||||
else
|
||||
if [[ "$state" != "down" ]]; then
|
||||
# On n'envoie qu'une fois la notification de panne (quand on était up).
|
||||
if [[ "$state" == "up" ]]; then
|
||||
down
|
||||
else
|
||||
# État initial inconnu : on se contente de mémoriser sans notifier.
|
||||
echo down >"$STATE_FILE"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep "$INTERVAL"
|
||||
done
|
||||
Loading…
Reference in a new issue