You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
508 B
Bash
25 lines
508 B
Bash
#!/bin/bash
|
|
|
|
# Get new IP, and push it to DNS server
|
|
# Maybe check new IP vs old stored IP, and if they're the same
|
|
# update, and also email myself that dynIP has changed
|
|
|
|
while getopts r:R: flag
|
|
do
|
|
case "${flag}" in
|
|
r) REMOTE=${OPTARG};;
|
|
R) REMOTELOCATION=${OPTARG};;
|
|
esac
|
|
done
|
|
|
|
newIP=$(curl -4 ifconfig.co)
|
|
oldIP=$(cat ~/.myIP)
|
|
|
|
if [[ "$newIP" != "$oldIP" ]]
|
|
then
|
|
echo $newIP > ~/.myIP
|
|
scp ~/.myIP $REMOTE:$REMOTELOCATION
|
|
# Email myself with the new IP so I can manually change anything
|
|
fi
|
|
|