- README.md: project overview, quickstart, sources summary - ARCHITECTURE.md: complete architecture, data flow, project structure - ROADMAP.md: 5-phase development plan (v0.1.0 → v0.5.0+) - CONTRIBUTING.md: dev setup, conventions, how to add a source - ntfy-bridge.example.yaml: fully documented configuration template - scripts/example-cron-disk.sh: example cron script → ntfy-bridge
26 lines
917 B
Bash
Executable File
26 lines
917 B
Bash
Executable File
#!/bin/bash
|
|
# example-cron-disk.sh
|
|
# Exemple de script cron qui envoie un résumé d'espace disque vers ntfy-bridge.
|
|
# À appeler depuis cron : 0 9 * * * /path/to/example-cron-disk.sh
|
|
|
|
NTFY_BRIDGE_URL="${NTFY_BRIDGE_URL:-http://127.0.0.1:9090}"
|
|
WEBHOOK_PATH="${WEBHOOK_PATH:-/webhooks/cron-disk}"
|
|
|
|
# Collecter l'info disque
|
|
DISK_INFO=$(df -h / /mnt/nfs /home 2>/dev/null | tail -n +2 | awk '{print " " $6 ": " $3 "/" $2 " (" $5 " used)"}')
|
|
|
|
# Construire le message
|
|
MESSAGE="💾 **Disk Usage Report** — $(date '+%Y-%m-%d %H:%M')
|
|
${DISK_INFO}
|
|
|
|
Warnings (>80%):
|
|
$(df -h / /mnt/nfs /home 2>/dev/null | awk 'NR>1 {gsub(/%/,"",$5); if ($5+0 > 80) print " ⚠️ " $6 " is at " $5 "%"}' || echo " ✅ All partitions under 80%")"
|
|
|
|
# Envoyer vers ntfy-bridge
|
|
curl -s -X POST \
|
|
-H "Content-Type: text/plain" \
|
|
-d "$MESSAGE" \
|
|
"${NTFY_BRIDGE_URL}${WEBHOOK_PATH}" > /dev/null
|
|
|
|
echo "Disk report sent to ntfy-bridge"
|