Jafner.net/homelab/fighter/scripts/ip_change_notifier.sh
Joey Hafner 6086222503
Reorganize root level of repo.
- Move homelab, Jafner.dev (now called blog) to root.
- Rename "archived projects" -> "archive"
- Rename "active projects" -> "projects"
- Rename "jafner-homebrew" -> "5ehomebrew"
- Rename "docker-llm-amd" -> "local-ai"
2024-07-16 12:17:55 -07:00

24 lines
416 B
Bash

#!/bin/bash
source ./webhook_secrets.env
generate_post_data() {
cat <<EOF
{
"content": "IP Address Changed",
"embeds": [{
"title": "IP Address Changed",
"description": "New IP: $1",
"color": "45973"
}]
}
EOF
}
IP=$(curl ipinfo.io/ip)
if [ "$IP" != "$(cat ip.tmp)" ]; then
curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data $IP)" $discord_webhook
fi
echo $IP > ip.tmp