29 lines
684 B
Bash
Executable File
29 lines
684 B
Bash
Executable File
#!/usr/bin/env nix-shell
|
|
#! nix-shell -i bash -p bash curl
|
|
|
|
function header {
|
|
echo =============================================
|
|
echo "$1"
|
|
echo =============================================
|
|
}
|
|
|
|
ip=$(curl -s -X GET https://checkip.amazonaws.com)
|
|
header "$ip"
|
|
header NAMECHEAP
|
|
|
|
hostname=@
|
|
domain=rotehaare.art
|
|
password="$PASSROTE"
|
|
base="https://dynamicdns.park-your-domain.com/update"
|
|
|
|
if host "$domain" 1.1.1.1 | grep "has address" | grep "$ip"; then
|
|
echo "$domain is currently set to $ip; no changes needed"
|
|
exit
|
|
fi
|
|
echo updating "$domain"
|
|
host="host=$hostname"
|
|
domain="domain=$domain"
|
|
password="password=$password"
|
|
curl "$base?$host&$domain&$password&ip=$ip"
|
|
echo
|