|
#!/bin/bash
|
|
|
|
cd /root/openhosting
|
|
|
|
#IP=`curl -s http://get-myip.com/ | grep -o -i "IP Address is (.*)" | sed -e "s/IP Address is //" | sed -e "s/ //g" | sed -e "s/(//" | sed -e "s/)//"`
|
|
|
|
#root@hp-smraka-1:/etc/cron.d# ssh router-wan-sa-1.bring.out.ba ifconfig ppp0 | grep addr
|
|
# inet addr:89.146.131.3 P-t-P:89.146.128.1 Mask:255.255.255.255
|
|
|
|
#ssh router-wan-sa-1.bring.out.ba ifconfig ppp0 | grep -o -i "inet addr:(.*) P-t-P:"
|
|
#ssh router-wan-sa-1.bring.out.ba ifconfig ppp0 | grep -o -i "inet addr\(.*\) P-t-P"
|
|
#net addr:89.146.131.3 P-t-P
|
|
|
|
IP=`ssh router-wan-sa-1.bring.out.ba ifconfig ppp0 | grep -o "inet addr:\(.*\) P-t-P" | sed -e "s/inet addr://" | sed -e "s/ P-t-P//" | sed -e "s/ //g"`
|
|
echo $IP
|
|
#exit 0
|
|
|
|
#echo "`date` $IP">last_call.txt
|
|
|
|
#echo "x${IP}x"
|
|
LAST_IP=`cat last_ip.txt`
|
|
|
|
#echo "last-ip = _${LAST_IP}_ , current ip = _${IP}_"
|
|
|
|
if [ "${LAST_IP}" == "${IP}" ]
|
|
then
|
|
|
|
echo "`date` : no ip change ${IP}">last_call.txt
|
|
exit 0
|
|
else
|
|
echo "`date` : IP CHANGE has happened - old ${LAST_IP} new ${IP} !">last_call.txt
|
|
fi
|
|
|
|
|
|
echo $IP>last_ip.txt
|
|
|
|
|
|
(cat <<TEXT
|
|
\$TTL 60
|
|
@ IN SOA @ root (
|
|
200705251 ; serial
|
|
60 ; refresh
|
|
20 ; retry - update retry
|
|
3W12h ; expiry - 3 weeks + 12 hours
|
|
10 ) ; minimum - 2 hours
|
|
MX 10 mail.sigma-com.net.
|
|
MX 50 mail-50.sigma-com.net.
|
|
IN NS ns.sigma-com.net.
|
|
|
|
sigma-com.net. IN A 128.177.28.71
|
|
ns IN A 128.177.28.71
|
|
vps-oh1 IN A 128.177.28.71
|
|
|
|
officesa IN A ${IP}
|
|
officeze CNAME officeze.dyndns.org.
|
|
|
|
|
|
mail-50 CNAME vps-oh1
|
|
|
|
mail CNAME mail-10
|
|
|
|
|
|
masine CNAME web-1
|
|
www.masine CNAME web-1
|
|
|
|
trac CNAME web-1
|
|
repos CNAME web-1
|
|
ifolder CNAME web-1
|
|
|
|
jabber CNAME java-infra-2
|
|
|
|
blogs-old CNAME web-1
|
|
|
|
|
|
nas-1 IN A 192.168.45.245
|
|
nas-1G IN A 192.169.45.245
|
|
park-1 IN A 192.168.45.235
|
|
park-3 IN A 192.168.45.233
|
|
sim-3 IN A 192.168.45.215
|
|
boing-1 IN A 192.168.45.230
|
|
boing-1G IN A 192.169.45.230
|
|
dualco-1 IN A 192.168.45.200
|
|
dualco-1G IN A 192.169.45.200
|
|
devbox IN A 192.168.45.195
|
|
wmr IN A 192.168.45.194
|
|
|
|
archive.sigma-com.net. CNAME nas-1.sigma-com.net.
|
|
|
|
svn CNAME web-1
|
|
bug CNAME web-1
|
|
|
|
dev-infra-2 CNAME officesa.sigma-com.net.
|
|
java-infra-2 CNAME officesa.sigma-com.net.
|
|
|
|
zimbra CNAME mail-10
|
|
blogs CNAME web-1
|
|
forums CNAME web-1
|
|
tickets CNAME web-1
|
|
|
|
web-1 CNAME dev-infra-2.sigma-com.net.
|
|
mail-10 CNAME dev-infra-2.sigma-com.net.
|
|
|
|
|
|
www CNAME web-1
|
|
|
|
samba CNAME officesa
|
|
|
|
web-146 CNAME officesa
|
|
zimbra-2 CNAME officesa
|
|
|
|
TEXT
|
|
) > tmp.zone
|
|
|
|
|
|
echo "ip sigma-com.net = $IP"
|
|
|
|
#scp sigma-com.net.zone root@ns.sigma-com.net:/var/named/sigma-com.net.zone
|
|
scp tmp.zone root@ns.sigma-com.net:/var/named/sigma-com.net.zone
|
|
ssh root@ns.sigma-com.net service named restart
|
|
|
|
echo "ip change has finished">>last_call.txt
|