On 21/10/13 20:08, n22e113 wrote:
> Hi, Anyone has a cron script I could borrow (and never pay back) to send an 
> email to myself whenever the external IP of any Leaf box has changed? Don't 
> really want to rely on external sites as they don't always work!
> Cheers,
> Kwon
>

Hi Kwon, here's one I used to check the success (or otherwise) of a 
DYNDNS update. You can use it as a basis.
Put it ib /etc/ppp/ip-up.d/ and set it's executable flag and it will get 
called by the ppp daemon whe an ip change occurs. After waiting for 
things to settle, it compares the old (cached) ip with the new one and 
act accordingly. I think the elements you want are here.

Cheers,

Bob von Knobloch


#!/bin/sh

# Compare dyndns cache with external ip address

for i in 1 2 3 4 5
do
        sleep 10

        # Get external address
        PPPADDR=`ip addr sh dev ppp0 | grep inet | sed -e "s/inet//; 
s/peer.*$//; s/^ *//"`

        # Get dyndns address from cache
        DYNADDR=`cat /tmp/ez-ipup | sed -e "s/.*\,//"`

        if [ $PPPADDR != $DYNADDR ] ;then
                echo "UNEQUAL"
                /etc/init.d/ez-ipupd start
        else
                break
        fi

        if [ $i -eq 5 ]
                then
                MAILHDR="Brandmauer - DynDNS Failure!"
                echo -e 'PPP    IP address: '$PPPADDR'\nDynDNS IP address: 
'$DYNADDR | 
mail -s "$MAILHDR" -h scenic.praxis.vk fw-ad...@praxis.vk
        fi
done


-- 
The Sun is out, the sky is blue, it's time to drive the MR2.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
------------------------------------------------------------------------
leaf-user mailing list: leaf-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/leaf-user
Support Request -- http://leaf-project.org/

Reply via email to