16 lines
272 B
Bash
16 lines
272 B
Bash
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
oldip=0
|
||
|
|
|
||
|
|
while /bin/true
|
||
|
|
do ip=$(ifconfig eth0 | grep 'inet addr:' | awk -F '[:]' '{ print $2 }' | awk '{ print $1}')
|
||
|
|
if [ $oldip != $ip ]
|
||
|
|
then url=$(head -n 1 /etc/ddnsurl)
|
||
|
|
curl -k "${url}&address=$ip"
|
||
|
|
echo updated $oldip to $ip
|
||
|
|
oldip=$ip
|
||
|
|
fi
|
||
|
|
sleep 60
|
||
|
|
done
|
||
|
|
|