What's new

Please help me set up a set up a cron job to auto update my IP

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

EeK

Regular Contributor
Hello,

I just got an Asus RT-AC87U and flashed it with Merlin's most recent firmware, mainly because of the DNS-based filtering. I live in Brazil and use the services of Borderless Internet and Unlocator to have access to US content from Netflix and HBO Now, among others.

Except for Netflix on my nVidia Shield TV, the DNS-based filtering worked flawlessly (I had to manually hard code the DNS servers on that device, even if HBO Now was working great). After that, I started reading about cron jobs, since both services I use have Dynamic DNS.

Unfortunately, I'm not a programmer, so even trying to write the simplest script caused me a huge headache. Therefore, I'd like to kindly ask you experts if you could guide me step-by-step on this task, as if you were talking to a 5-year-old.

I got as far as enabling SSH and JFFS on the router, opening Terminal (I'm on a Mac - OS X El Capitan) and doing the following:

ssh MyUserName@MyRouterIP
password
cd /jffs/scripts
vi ddns-start

Then I proceeded to type the script I wrote combining information from Borderless Internet and Unlocator (but using the servers of only one of them, obviously):

#!/bin/sh

0 * * * * root wget https://borderlessinternet.com/updateip?remote=MyID

esc
:w q

chmod a+rx /jffs/scripts/ddns-start

And that's it. I don't know if I had to use quotation marks for the script, or even if I did everything right up to this point. When trying to run the script (./ddn-start), I get a "line not found" error.

It would be great if my router could update my IP automatically so I don't have to do it myself everyday (my ISP uses dynamic IPs).

Thank you in advance!
 
RMerlin's most 'recent' firmware is a beta. Which one have you actually flashed?

And have you performed a minimal and manual configuration after flashing firmware?

http://www.snbforums.com/threads/no...l-and-manual-configuration.27115/#post-205573

Hi, L&LD. Thank you for the reply.

I flashed the latest stable release, according to Merlin's own website: 380.59 (May 10th). I also reset to factory settings and followed most of the guidelines suggested on your other post (some of which I wasn't previously aware of).

you got most of the way there on your own!

the line in the script should be

cru a checkdns 0 * * * * "wget https://borderlessinternet.com/updateip?remote=MyID"

You will either need to add the root certs to your router or use --no-check-certificate on your wget command

Hi, buddyp! Thank you for the reply and the kind words of encouragement.

I followed your advice and my final script looked like this when I typed it into vi ddns-start:

#!/bin/sh

cru a checkdns 0 * * * * --no-check-certificate "wget https://borderlessinternet.com/updateip?remote=MyID"


I had no idea how to add the root certs to my router, so I just went with your suggestion of --no-check-certificate.

I no longer get any errors after typing ./ddns-start, so I guess it worked? My ISP hasn't updated my current IP yet, so there is no way of knowing for sure until they do.

As as follow-up question, is it possible to add a similar cron job for my other Smart DNS service (Unlocator), or I can only run one at a time? Unlocator's API URL is http://unlo.it/Your_API_KEY_HERE, but I'm not sure if I can input another line of code on the same ddns-start script.

P.S.: I'm aware I'm using generic API URLs in my posts and that I have to include my actual ID in them.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top