OpenDNS updater for linux/ubuntu

The OpenDNS service is great — it provides anti-phishing and the ability to filter out some of the less desirable detritus from the internets.

OpenDNS needs to be periodically notified about what your IP address is, and I don’t have a windows or macintosh box that’s always on. I do have an ubuntu box, though, but there weren’t any instructions on OpenDNS’ site to do this properly.

Cron does periodic jobs very well — but rather than using “crontab -e”, it’s much better to install a system-level cron job by adding a file to the /etc/cron.d directory. The file only needs to be readable — there’s no need to set the execute bit. You can choose the effective user that will run the command (in this case I ran as “nobody”), and a backup of your system that includes /etc will pick up your crontab entry.

Here’s the contents of /etc/cron.d/opendns:

47 * * * * nobody curl -u USERNAME:PASSWORD -s https://updates.opendns.com/nic/update | grep -vE "^good"

Replace USERNAME and PASSWORD with your opendns username and password.

The grep squelches success messages. No news is good news.

Related posts:

  1. Installing Trac on Ubuntu
    Here’s the condensed version, using the installation guide for help: Install the software sudo apt-get install python-setuptools python-subversion sudo easy_install Trac Initialize the Trac project We’re going to run the......
  2. HOWTO install etherpad on ubuntu 9.10
    Etherpad was opensourced by google, and has some generic installation instructions. Here’s the translation for Ubuntu Karmic Koala (release 9.10): Install the prerequisites: sudo apt-get install mysql-server-5.1 mercurial sun-java6-jdk sun-java6-jre......
  3. Simple MySQL backup to gmail on Ubuntu/Debian
    Backing up your MySQL database (if it’s a reasonable size, like < 100s of MB) can be done with a cronjob that runs mysqldump, gzip, and mpack. First set up......
  4. How to bounce an application with Applescript
    Say, for whatever reason, you want to bounce iphoto once an hour. You can do that with AppleScript and cron. Copy this into ~/bin/bounce-iphoto: #!/usr/bin/osascript on appIsRunning(appName) tell application &quot;System......

This entry was posted in Technical HOWTOs and tagged , , , . Bookmark the permalink.

2 Responses to OpenDNS updater for linux/ubuntu

  1. Darrell Denlinger says:

    Could you add a few sentences about why you prefer cron.d to crontab -e?

  2. matthew says:

    @Darrell: Sure. When I backup a unix box, I normally only worry about rsync’ing /etc, /home, and then doing a mysqldump. Because crontabs are stored in /var/spool/cron, it’s just one more thing to worry about backing up and restoring later.

    Automated installation scripts are also possible with cron.d, because the script knows it owns a whole file, rather than trying to do surgery on a file it has to share with other applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Additional comments powered by BackType