Friday, July 31, 2020
starting my own ddns.
have my own vm with westhost… barilin.com
using cron.
# Updated 2/9/19 2,7,12,17,22,27,32,37,42,47,52,57 * * * * /root/bin/reportipaddress &> /dev/null
I have it running the foloowing every 5 minutes…
pushing the IP Address up to my VM
root@cp1:~/bin# cat reportipaddress DATE=/usr/bin/date QUERY="" QUERY="/usr/bin/curl http://barilin.com/whatipaddressami" $QUERY if [ "$QUERY" != "" ]; then $ECHO $DATE >> /var/log/reportipaddress.log fi; root@cp1:~/bin#
I have it report into my vm and have it query a non exsistant url..
Then I parse the logs every 5 mintues with cron
5,10,15,20,25,30,35,40,45,50,55,59 * * * * ~/bin/5minutes.sh
cron calls a script
[uscopley@sl-508-21 bin]$ cat 5minutes.sh CAT=/usr/bin/cat FILE="/home/sites/36b/1/193edadd3a/access-logs/barilin.com" HEADHTML="/home/sites/36b/1/193edadd3a/bin/5minutes.head" TAILHTML="/home/sites/36b/1/193edadd3a/bin/5minutes.tail" GREP=/usr/bin/grep TAIL="/usr/bin/tail -10" STRING=whatipaddressami REPORT="/home/sites/36b/1/193edadd3a/www/reportipaddress.html" # # # $CAT $HEADHTML > $REPORT $CAT $FILE | $GREP $STRING | $TAIL >> $REPORT $CAT $TAILHTML >> $REPORT # # # #cat ~/access-logs/barilin.com | grep whatipaddressami | tail -3 > ~/www/reportipaddress.html
The next part hasn’t been written yet. I’m going to grab that ip address that’s reported
and shove it into dns… With my home A name.