Koozali.org: home of the SME Server
Legacy Forums => General Discussion (Legacy) => Topic started by: Scott Lewis on March 28, 2002, 12:07:59 PM
-
Now, I use DNS2GO but every know and again the IP goes offline. So I want a backup, is there any script/app that I can install under E-smith and get it to send my ip to a webpage or via e-mail to me as certain intervals.
Scott
-
Hi Scott,
I'm no expert but here's one way (not necessarily elegant).
In the following example,
eth1 is my external interface
someone@somedomain.com is the e-mail you want to send the notice to
Create a script file (eg. mailIP) with this command line :-
ifconfig eth1 | grep -i 'inet addr:' | mail -s 'IP Address' someone@somedomain.com
Then create a cron job for this script at the appropriate interval.
This will e-mail someone@somedomain.com with a message with the subject "IP Address" and contains a line like this :-
inet addr:aaa.bbb.ccc.ddd Bcast:255.255.255.255 Mask:255.255.255.0
(Sorry, don't know enough commands to just filter out everything but the IP address. Anyone who can further refine this, please do so as it would be good to learn some new commands).
Kelvin
-
Thanks Kevin. Pretty new to Linux and dont even know how to add a cron job.
Scott
-
Install man and read the man page for crontab. This will tell you the correct syntax for cron. Another solution you might consider in this case is to add the script to the end of the 'ip-change' event, because that's when you would want the script to run. It's somewhere in /etc/e-smith/events/. Make a symbolic link to the script (man ln) and make it start with a high number: that will make it run last in the sequence.
HTH,
Robert