WAN IPCheck - Send an email if WAN IP has changed

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Contributions Upload
Goto page Previous  1, 2, 3, 4  Next
Author Message
DD-WRT Novice

Joined: 21 Jul 2009
Posts: 19

PostPosted: Mon Aug 10, 2009 3:00    Post subject: Reply with quote
Unfortunately when I go to the management page in administration I do not see JFFS2 at all Sad
DD-WRT Novice

Joined: 21 Jul 2009
Posts: 19

PostPosted: Wed Aug 12, 2009 19:07    Post subject: Reply with quote
Please help anyone... please please. Embarassed Embarassed Confused Sad

Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Mon Sep 07, 2009 8:08    Post subject: Reply with quote
A little search in the WIKI shows that when running the Mini version (prolly because your router doesn't support the STD or other versions) that you don't have JFFS because there's no more space on the flash chip.

No need to kick the topic up over and over again while a little search yourself could've given you the answer Smile

Firmware: DD-WRT v24-sp2 (latest available) mega

DD-WRT Novice

Joined: 17 Nov 2009
Posts: 1

PostPosted: Tue Nov 17, 2009 10:25    Post subject: Reply with quote
I'm having difficulties getting this to work... so the built-in sendmail (which is part of busybox) is throwing 255 whenever i try this on the command line and obviously there's no usage:

root@DD-WRT:/tmp# cat blah | /usr/sbin/sendmail -s smtp.att.yahoo.com -f <my email> <same email>
root@DD-WRT:/tmp# echo $?

is there more to specifying the smtp server? does this even work without ssl anymore?

after uploading the utility in the zip file (via scp) it segfaulted when running so i can't try that one.

btw, "nvram get wan_ipaddr" gets me which is clearly not what i'm looking for... this is ok as i can just parse the wget output of whatsmyip.us

Any help appreciated, i'm working on WRTS54GL with standard size dd-wrt...

DD-WRT Novice

Joined: 28 Feb 2010
Posts: 1

PostPosted: Sun Feb 28, 2010 21:55    Post subject: Reply with quote
thanks,good resource
DD-WRT Novice

Joined: 09 Mar 2010
Posts: 1

PostPosted: Tue Mar 09, 2010 23:59    Post subject: username and password Reply with quote
thank you for your work
finally I've downloaded the zip file
but is there anyway to set the username and password for the mail server?
DD-WRT Novice

Joined: 06 Apr 2010
Posts: 9

PostPosted: Fri Apr 09, 2010 10:29    Post subject: Reply with quote
Sorry for a noob question but I hav eonly jsut flashed my linksys with dd-wrt yesterday but also its down due to repair (well it has overheating issue I plan to solve tomorrow).

My question is what is INTERVAL=3600 representing? Checks every 1 hours or 1 minutes?


Sorry! Forget that. I just read the srript and saw it uses the sleep command which without a switch means 3600 is in seconds. Thus it checks every minute. My Bad.
DD-WRT Novice

Joined: 01 May 2010
Posts: 6

PostPosted: Sun May 02, 2010 16:12    Post subject: Help with this script Reply with quote
hi all,

i'm trying to use this script in a WRT54G2 V1 Linksys. My firmware version is dd-wrt "micro plus ssh"
This router doesn't have any jffs or external card to use as a storage. So i will charge the files everytime the router starts. Before, i'm trying to do it from console executing commands.

What i'm doing is from ssh console, downloading "sendmail" and "wanipcheck.sh" using wget and saving them to to /tmp; later i make them executables (chmod +x ...)

Then, when trying to execute sendmail (./sendmail) i got "segmentation fault". And nothing happens.
If i execute wanipcheck.sh, apparently it works ok as i can see the process with "ps".

If there's another way of sending emails from this router i would love to hear it (¿netcat?, ¿/dev/tcp?, ¿expect?)

Any help will be appreciated.

Maxi Razz
DD-WRT Novice

Joined: 29 Apr 2011
Posts: 6

PostPosted: Fri Apr 29, 2011 21:52    Post subject: Reply with quote
my problem with this is that I get a "connect: Connection refused".
My mail server is mail.gmx.net; how can I add login / authentification information into your wanipcheck.sh?

edit:\> Maybe this isn't about SMTP auth, but because of something else...
I tried in the Command Shell of the dd-wrt webinterface this line
../jffs/usr/bin/sendmail "test" -f"fromAdress@gmx.de" -s"mail.gmx.net" "toAdress@googlemail.com"

If I run this command, I get this output:
../jffs/usr/bin/sendmail: connect: Connection refused
I googled about this error but didn't come up with an exact reason nor solution Confused
DD-WRT Novice

Joined: 17 May 2011
Posts: 1

PostPosted: Thu Jun 02, 2011 19:55    Post subject: mini sendmail problems Reply with quote
Hi there!

I'm using a linksys wrt54gl with DD-WRT v24-sp2 (07/21/09) voip.

For some reason even if I enabled jffs from the web interface I cannot create any folders under /jffs.

Other than that, I've tried to use sendmail with little luck. Basically this is what I execute:

echo 'Subject: test' | ./sendmail -s"smtp.gmail.com" -f"myAddress@gmail.com" "myAddress@gmail.com"

and I get a timeout from sendmail.

Any suggestions?

DD-WRT Novice

Joined: 05 Jan 2012
Posts: 2

PostPosted: Sun Jan 08, 2012 15:21    Post subject: getting sendmail errors... Reply with quote
i'm trying to run the script, but i keep getting sendmail error:

root@Pargul:/jffs# MAIL_SERVER=
root@Pargul:/jffs# MAIL_TO=6684@1500.co.il
root@Pargul:/jffs# MAIL_FROM=router@pereg.home
root@Pargul:/jffs# MAIL_SUBJECT="Ip address changed @ Home"
root@Pargul:/jffs#    echo "Subject: $MAIL_SUBJECT"              > /tmp/mailnotification
root@Pargul:/jffs#    echo "WAN IP-Address has changed to: $1"  >> /tmp/mailnotification
root@Pargul:/jffs#    echo "Previous known WAN IP-Address: $2"  >> /tmp/mailnotification
root@Pargul:/jffs# MAIL_BINARY=/jffs/sendmail
root@Pargul:/jffs#    cat /tmp/mailnotification | $MAIL_BINARY -s$MAIL_SERVER -f$MAIL_FROM $MAIL_TO
/jffs/sendmail: line 1:EL: not found
/jffs/sendmail: line 2: syntax error: "(" unexpected

any ideas?
DD-WRT Novice

Joined: 16 Jan 2012
Posts: 1

PostPosted: Tue Jan 17, 2012 6:14    Post subject: Reply with quote
I set up my DDWRT router so that I can use it as an SSH server. I wanted to use it in conjuction with TOR + Tails for my laptop and Orbot and Orweb for my Droid X. I configured my Buffalo router to do this and I set a port forward on my DSL modem/router that the Buffalo is behind. I have a dynamic IP, so I pieced together a script in Auto Hotkey that would check whatismyip.org, save the IP as a file, and email it to me on a scheduled basis using System Scheduler v4.17. This setup works great for me.

In order for this to work I have to leave my computer running. I did a google search and found this thread. I figure the router running a script like my Auto Hotkey script would consume less power. Also, my Droid X doesnt play well with WPA on my DSL modem/router so I leave this router running with WEP all the time for my Droid anyway.

I have been reading through the forum for a few nights. I have made headway with some things but I need a little push either by direct answers or guidance to the proper tutorials.

+I already set up SSH on the Buffalo router so I was good to go there.

+I enabled jffs on the Buffalo and I have over 2 MB of space.

+I downloaded wanipcheck.sh and sendmail.

+I acquired WinSCP and I am now familiar with how to use it.

+I downloaded Notepad++ to edit wanipcheck.sh, I understand what the code is trying to accomplish, and I think I can configure it the way I need it.

Here is where I have hit a rut.

1. (This may well be the most retarded question of the evening) What file path do I put wanipcheck.sh and sendmail in?

2. Since my Buffalo is behind another router, will "nvram get wan_ipaddr" in wanipcheck.sh just give me the IP of my DSL modem/router as was mentioned by another poster?

If "nvram get wan_ipaddr" will only return my DSL modem/router's IP, I would like to figure out how to get wanipcheck.sh to get the public IP from whatismyip.org. I have read in this forum somwhere that v24 of DDWRT already does this if the INADYN setting is configured. Either way, how do I resolve this issue?

After I figure out these two points, I dont think I will have any problems executing the script and saving it to run on startup.

I know that I can use DYNDNS, but I do not want to. I have enjoyed learning something new by taking the harder path to travel.

Any answers will be much appreciated, and direction to the proper reading material will be just as much appreciated.

Buffalo WHR HP G54
DD-WRT v24 RC-6 01/02/08 std
DD-WRT Novice

Joined: 06 Feb 2011
Posts: 3

PostPosted: Sun Jan 29, 2012 17:05    Post subject: Reply with quote
I am having a few problems getting this script to run. I have a few basic questions if anybody is able/willing to answer them.

First off, when you edit the code variables is the following changed correctly:

MAIL_BINARY=/jffs/sendmail (is this directory correct since I have enabled jffs?)
MAIL_SERVER=smtp.isp.com (will sendmail send an email though smtp.gmail.com? if this older sendmail will not, is there a current version that will work with TLS and SASL?)
MAIL_TO=emailto@isp.com (self explanatory, my email)
MAIL_SUBJECT="Some subject for your email"

Now, when placing the script file (wanipcheck.sh) onto my router using WINSCP via drag and drop, where do I place it?

Do I create a directory in jffs called: jffs/etc/config and place it in there since it was not already created when I have enabled my jffs partition in my router???

Finally, when I have these two files in the correct location, should visiting the command section and enabling the startup command : ./wanipcheck.sh & start the script and keep it running. Also, is there a command I can type in to confirm the script is running?

I have done the above, but my router doesn’t seem to be starting the script it will not find the directory, any suggestions since I am new to placing running scripts on the router?
DD-WRT Novice

Joined: 10 Apr 2012
Posts: 1

PostPosted: Fri Apr 13, 2012 1:00    Post subject: Reply with quote
Thx @cyberde for your Script.

I have a TP-Link WR1043ND with the actual DD-WRT Firmware from BrainSlayer 2012-03-19 r18777

Since the Busybox has implemented sendmail, I use the sendmail command witch comes with the firmware.

I changed the file extension to .startup and put it into the folder /jffs/etc/config/wan_ipaddr.startup
So it will execute at startup
Don't put it into /tmp/etc/config/wan_ipaddr.startup (with will also work). But this folder will be cleared after reboot.

I added an USB-Stick to the router and mounted it to /jffs

In the script you have to customize your settings.
# Here are the settings

copy it into /jffs/etc/config/wan_ipaddr.startup and reboot the router.

Now the script should send an e-mail at startup with the actual WAN-IP-adress with timestamp. Like:
2012-04-13_02:26 - IP: / NETMASK: / GATEWAY: / DNS:

It also create an LOG_FILE at /jffs/wan_ipaddr_list.txt witch contains all previous WAN-IP-adresses.
The log file will be send as attachment on each e-mail.
The script will check every hour (3600 seconds) if the WAN-IP-adress has changed, and if it has changed it will send you the next status-mail.

To check if the script will work, you can execute it manually.
Log into the router by SSH connection and execute the script by "sh /jffs/etc/config/wan_ipaddr.startup".
You will see the SMTP response of your ISP. To stop the script you have to press ctrl + c.

To check if the script is running after a reboot type "ps".
If you find something like
/bin/sh -c /jffs/etc/config/wan_ipaddr.startup
{wan_ipaddr.star} /bin/sh /jffs/etc/config/wan_ipadd
the script is successful running.

Download the script HERE.
(You have to be logged in to the forum)
DD-WRT Novice

Joined: 09 Jun 2012
Posts: 6

PostPosted: Sat Jun 16, 2012 6:56    Post subject: Using Gmail Reply with quote
I want send mail using Gmail SMTP, What to write in the settings, Please help..
Goto page Previous  1, 2, 3, 4  Next Display posts from previous:    Page 3 of 4
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Contributions Upload All times are GMT


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum