Init and fix ip_change_notifier script
This commit is contained in:
parent
e0415f5ffa
commit
4d23714868
3
.gitignore
vendored
3
.gitignore
vendored
@ -4,4 +4,5 @@ jafner-net/config/ddns/ddclient/ddclient.conf
|
||||
service-key.json
|
||||
.terraform/
|
||||
.terraform.lock.hcl
|
||||
terraform/infrastructure/.tfvars
|
||||
terraform/infrastructure/.tfvars
|
||||
ip.tmp
|
24
fighter/scripts/ip_change_notifier.sh
Normal file
24
fighter/scripts/ip_change_notifier.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/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
|
Loading…
Reference in New Issue
Block a user