Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: Tweekified on November 09, 2007, 06:57:11 PM

Title: Is there a way to use sme to email me of an ip change?
Post by: Tweekified on November 09, 2007, 06:57:11 PM
I am unable to get a static IP from my ISP.  I like the email server and the web server features.  I just need a way to have this server notify me of ip change so i can update my domain register info to point to new ip.  I would be best by email, but if could be by like icq or something like that too.
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: Boris on November 09, 2007, 07:20:03 PM
Look for ddclient addon. It supports many dynamic dns services and sends the e-mail with status to admin.
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: arne on November 09, 2007, 09:22:43 PM
The way I do this is to run a wget command as a cron job every hour. It can then be possible to see the ip in the log of the web server. (wget http://.........). A slightly different variant is if this wget target also have a dns server that hets uptated via this link/cronjob. (That's the way I do it just now.)
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: uniqsys on November 10, 2007, 03:37:33 AM
Quote
I just need a way to have this server notify me of ip change so i can update my domain register info to point to new ip.

You want to update your domain register? How often is the IP changed.  You might be doing this several times an hour. What about using DynDNS.org to register your domain dynamically for you?  Or am I not understanding your post properly?

In any event, there is a fairly straightforward way using cron to see the IP on a scheduled basis.  This is similar but different from what Arne is suggesting.  I ran into the same problem a few years ago. We got sophisticated and wrote a script to check to see if the old external IP had changed and if so mail the new IP to us, but it got too fancy and I can't find it at the moment.  A basic way to do this is in concept is:

1. Write a script that sends the ifconfig info to a temporary file  eg /sbin/ifconfig > /tmp/temporaryfile
2. In that script, mail the info from the file to yourself.  eg mail admin@yourdomain.com </tmp/temporaryfile
3. set this script up as a cron job using standard SME custom templates (or the crontab manager contrib).  You decide how often you want the cron job invoked.

So you get regular, every second if you like, emails on what the IP is, determined by your crontab settings.

See the manual on custom templates and crontab for more information
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: stephen noble on November 10, 2007, 04:20:48 AM
put the email script (action) in one of these (events)
/etc/e-smith/events/ip-*
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: mmccarn on November 10, 2007, 07:37:38 PM
Here you go: http://bugs.contribs.org/show_bug.cgi?id=3542#c2

'IPNotify' will send an email notice to any local account or pseudonym whenever the 'ip-change' event is triggered.

Supported configuration settings:
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: Tweekified on November 11, 2007, 06:48:44 AM
I currently own a domain name via godaddy.  I currently have it pointed to my current Outside IP address.  But my Ip from my ISP is not static.  So if they change my ip, now my webpage goes down and i am unable to remote admin if i dont know the new ip address.  So if it could just email to an outside email address on change or a daily update, i could then remotely update my domain to point to new ip address. 

Thanks for all the posts so far.   
Title: Re: Is there a way to use sme to email me of an ip change?
Post by: raem on November 11, 2007, 01:46:19 PM
Tweekified

mmcarn provided you with a nice script to do what you want.

To send to an external email address, simply create a new user account on your sme server and then setup that user to forward to an external email address.
Configure the Notify emailname using (enter the newly created user account):
config setprop IPNotify Notify "emailname"
    * default: admin
    * must be a local user or pseudonym