?
Solved

Email script for ip change.

Posted on 2003-03-04
7
Medium Priority
?
207 Views
Last Modified: 2010-04-21
This is a two part question.
Question 1:
I would like to write a script that would email me telling me if the servers ip address has changed. since the server is on a network that uses dhcp.

Question 2:
I would also like a script to email me when a person logs onto the server as well.

Basic Info. About the Server:
The OS is mandrake 9 I have SSH runining on it. I use the server to store invoices and workorders on it. I set the server up so that a client can logon and retrive their invoices when that need them. The problem I am haveing is that the server has its ip address updated once a week since. so I have to go to the server and do an ifconfig to see the new ip address.
thanks in advance
0
Comment
Question by:janus1840
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 8

Expert Comment

by:akshayxx
ID: 8069269
since Server updates its IP address after some intervals, and ur client is connected to the server using that IP address only, then u have a problem.


but there is a solution .. as i can guess your Server is connected to the outer world using that dynamic IP, and my guess is that your other computers are on LAN, so if you dont need your client computers to connect to external world. in that case u can use the LAN ip to connect to your server.
and about sending email .. well tell me how do u check email on your client computers.
The smtp/mail server that they connect to , does it have static IP ? if it doesnt OR if you connect to SMTP server through your SERVER then again your mail setup will also have to be changed.



0
 
LVL 1

Expert Comment

by:jcaldwel
ID: 8073882
$host www.experts-exchange.com  | awk '{print $4}'
will return the current ip address for a hostname. You could set up a cron job to build a list of the ips and compare the results with last time (build a file somewhere)

0
 
LVL 1

Expert Comment

by:jcaldwel
ID: 8073910
Part 2 of the question:

add this into the /etc/profile script
echo "." | mail -s"login from `whoami` at `date`" myemail@mydomain.com

0
How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

 

Author Comment

by:janus1840
ID: 8074398
Ok Let me explain my self a little better. I have a system that is running mandrake 9. the system has shorewall and ssh running on it. the server is on a cable modem due to the fact that our office is getting remodeled. I have clients that would log on to the server when the server was in my office and they were able to retrive reports and their invoices. but now that the server is not on my network and its at my friends house the server now gets a dynamic ip address. my clients will try to log onto the server to retrive reports or invoices and the servers ip address has changed my clients would then call me up asking whats the servers ip address I then have to call my friend and have him logon to the server and do an ifconfig he then tells me what the ip address is and I then inform my client. I have 57 clients so just think how many calls a day i get about whats the servers ip address.
0
 

Author Comment

by:janus1840
ID: 8074411
Ok Let me explain my self a little better. I have a system that is running mandrake 9. the system has shorewall and ssh running on it. the server is on a cable modem due to the fact that our office is getting remodeled. I have clients that would log on to the server when the server was in my office and they were able to retrive reports and their invoices. but now that the server is not on my network and its at my friends house the server now gets a dynamic ip address. my clients will try to log onto the server to retrive reports or invoices and the servers ip address has changed my clients would then call me up asking whats the servers ip address I then have to call my friend and have him logon to the server and do an ifconfig he then tells me what the ip address is and I then inform my client. I have 57 clients so just think how many calls a day i get about whats the servers ip address.
0
 
LVL 1

Accepted Solution

by:
rduta earned 400 total points
ID: 8131326
1) good luck!  since the IP address on the host is probably
derived by DHCP, and is a nonrouted address you may have a really hard time.  If you get a real routed IP address then
www.dyndns.org will work OK.  If not you'll have to resort
to someting more sinister.  Write or find a server/client with a push from the hosts to a central server (CGI for example).

2) I would use someting like swatch or logcheck:
http://www.dlhoffman.com/publiclibrary/RPM/contrib/libc6/i386/logcheck-1.1.1-1.i386.html
or swatch.
0
 

Author Comment

by:janus1840
ID: 8192446
thanks for the advice sorry about not replying sooner I was in the middle of remodeling my office.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question