Re: [SLE] automaticaly send an IP change
From: Brad Bendily (brad_at_selu.edu)
Date: 06/14/05
- Previous message: JB: "Re: [SLE] Anyone else having Konqi crash in Yahoo mail?"
- In reply to: James Knott: "Re: [SLE] automaticaly send an IP change"
- Next in thread: Sunny: "Re: [SLE] automaticaly send an IP change"
- Reply: Sunny: "Re: [SLE] automaticaly send an IP change"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 14 Jun 2005 10:57:41 -0500 (CDT) To: suse-linux-e@suse.com
> > Is there a script/package which can check the external IP on regular
> > basis and send the changes to an email?
>
> Is the host name consistent? If so, you can just do a dns lookup. If
> the host name changes with the IP, then that won't work. Another
> possibility, is a dynamic dns server, which many firewall/routes can be
> configured to use.
Here's a script that I made that at first I ran every 12 hours at my
house. Until I made the script below that runs hourly.
Also worth noting is that this stuff is running on RedHat 7.x
#!/bin/sh
FILE2=`echo "/fwlog/ifconfig.txt"`
touch /fwlog/ifconfig.txt
ifconfig eth0 | grep inet | awk -F: '{print $2}' | sed 's/Bcast//' > /fwlog/ifconfig.txt
mv -f /fwlog/ifconfig.txt $FILE2
cat $FILE2 | mail -s"IP address, ifconfig" email@gmail.com
I have another script that checks the ip and only sends an email if it's
changed. This may be better for you. This runs hourly.
#!/bin/sh
ifconfig eth0 | grep inet | awk -F: '{print $2}' | sed 's/Bcast//' >
/etc/fw/ipcheck
I=`cat /etc/fw/ip`
#IP2=`cat /etc/fw/ipcheck`
P=`cat /etc/fw/ipcheck`
#echo "My ip is $IP1"
#echo "My ip is $IP2"
if [ "$I" != "$P" ]; then
/etc/./ipshow
/etc/fw/./fw
rm -rf /etc/fw/ip
cp /etc/fw/ipcheck /etc/fw/ip
#echo "My ip is $I"
#echo "My ip is $P"
#else
#exit 0
fi
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
- Previous message: JB: "Re: [SLE] Anyone else having Konqi crash in Yahoo mail?"
- In reply to: James Knott: "Re: [SLE] automaticaly send an IP change"
- Next in thread: Sunny: "Re: [SLE] automaticaly send an IP change"
- Reply: Sunny: "Re: [SLE] automaticaly send an IP change"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|