20 lines
419 B
Bash
20 lines
419 B
Bash
#!/bin/bash
|
|
|
|
# selfHOST DynDNS Update Script
|
|
|
|
URL='https://549335:GoviYPrfj4XI@carol.selfhost.de/nic/update?myip='
|
|
|
|
# Get current public IPv4 address
|
|
PUBLIC_IP=$(curl -4 -s https://api.ipify.org)
|
|
|
|
# Exit if IP detection failed
|
|
if [ -z "$PUBLIC_IP" ]; then
|
|
echo "$(date): Failed to determine public IP"
|
|
exit 1
|
|
fi
|
|
|
|
# Send update to selfHOST
|
|
RESULT=$(curl -s "${URL}${PUBLIC_IP}")
|
|
|
|
echo "$(date): IP=${PUBLIC_IP}"
|