* This one time, at band camp, Scott Ragen said:
> Hi all,
> I've been looking for a good hardy script/program that will run commands I
> specify when an ip address on ppp0 (adsl) changes.
> I need to run commands like iptables restart, ddclient (to change the
> dyndns.org dns) and restart the vpn.
> Does anyone have any suggestions, ddclient apparently can, but I couldn't
> get it to work because I think it performs the commands after it changes the
> domain name, which it can't because of iptables firewall.
> 

########################################################
#!/bin/sh

IP=`ifconfig ppp0 | egrep 'inet addr' | awk '{print $2}' | sed 's/addr://'`
SAVEFILE='/tmp/oldip'
SAVE=`cat $SAVEFILE`

if [ "$IP" != "$SAVE" ]; then
        # do some stuff
        echo $IP > $SAVEFILE
fi
########################################################


This is only a very quick (and very untested) idea, but you should be
able to adapt it to do what you want.

Let me know if you need more of a hand.

Greeno
-- 
Greeno <[EMAIL PROTECTED]>
GnuPG Key :  1024D/B5657C8B 
Key fingerprint = 9ED8 59CC C161 B857 462E  51E6 7DFB 465B B565 7C8B

Imagine working in a secure environment and finding the string 
_NSAKEY in the OS binaries without a good explanation
    -Alan Cox 04/05/2001

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to