On Tue, May 27, 2014 at 10:33 AM, Rich Shepard <[email protected]> wrote:
>    Something changed this morning that affects the working of my
> keep-A-record-ip-address-current script. I just manually upgraded the IP
> addresses for the two domains at namecheap.com (they were different, too).
>
>    Expert advice needed. Here's the shell script (ngetip.sh):
>
> #!/bin/bash
> OLDIP=$(cat /home/rshepard/CURRENTIP)
> NEWIP=$(curl -s http://icanhazip.com)
> if [ "$NEWIP" != "$OLDIP" ];  then
>    if [ -z "$NEWIP" ]; then
>       echo "FATAL: curl did not return a new IP"
>       exit 2
>     fi
>      echo $OLDIP
>      echo $NEWIP
>      echo $NEWIP > "/home/rshepard/CURRENTIP"
>      echo $NEWIP >> "/home/rshepard/getiplog"
>      /usr/bin/curl -s
>      / 
> "https://dynamicdns.park-your-domain.com/update?host=@&domain=appl-ecosys.com&password=***&ip=$NEWIP";
>   >/dev/null
>      /usr/bin/curl -s
>      / 
> "https://dynamicdns.park-your-domain.com/update?host=@&domain=twodogs.us&password=****&ip=$NEWIP";
>   >/dev/null
> fi
>
>    http://icanhazip.com returns the current IP address. However, when I enter
> https://dynamicdns.park-your-domain.com in the Web browser, I get a server
> error: 404 file or directory not found.

This is normal behaviour. Unless you give it the full url as given in
your script.

A much simpler script would be
#!/bin/bash
/usr/bin/curl -s
"https://dynamicdns.park-your-domain.com/update?host=@&domain=appl-ecosys.com&password=***";
 >/dev/null
/usr/bin/curl -s
"https://dynamicdns.park-your-domain.com/update?host=@&domain=twodogs.us&password=****";
 >/dev/null

Notice I left the &ip=$NEWIP  out. If you do not include the ip, it
gets the ip address from the client packets.

Also I left off all the checking to see if the IP address has changed.
This gets rid of one of the main places the script could fail.

Bill
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to