LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 01-13-2004, 01:36 PM   #1
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Rep: Reputation: 35
Semi-Daily Cron Job


Background: I have dynamic IP address that changes maybe once every 2 or 3 weeks. I run a daily cron job that updates several domain names at Zoneedit at 4AM each day. This keeps my domains running when my IP address changes. If I notice the IP address has changed during the day, I manually run the job one time.

Mini Problem: I am going to be on vacation for a couple of weeks soon, so I will not be able to do this manual job run during the day. I would prefer not to hit Zoneedit hourly by changing the cron job to hourly. Is there a way to run the cron job maybe every 6 or 8 or 12 hours instead?

Thanks,
Apollo
 
Old 01-13-2004, 01:40 PM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Sure, something like this would tell it to run every 6 hours on the top of the hour, etc:

*/6 * * * <your-script/command>

You could even set the specific times too to run like this:

0 10-20/3,11 * * * <your-script/command>

That one above would do it from 10 am to 8pm every 3 hours and once at 11pm as well..

man crontab.. lots of good info.

Last edited by trickykid; 01-13-2004 at 01:42 PM.
 
Old 01-13-2004, 01:41 PM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374Reputation: 2374
Cron offers that feature (man 5 crontab):

30 00-23/6 * * * <yourscript>

Starting at 00:30, <yourscript> will be executed every 6 hours.
 
Old 01-13-2004, 02:01 PM   #4
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
Ok, looks easy and even a bit better than I had hoped for.

Thanks for the help!
 
Old 01-13-2004, 02:06 PM   #5
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by Apollo77
Ok, looks easy and even a bit better than I had hoped for.

Thanks for the help!
May I ask how your have your scripts autoupdate zoneedit.com? I use it as well for a domain but not sure how you have a script update this when I only see web pages to update, etc? I must be missing something..

Cool, glad that worked for you though..
 
Old 01-13-2004, 03:02 PM   #6
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
You can update multiple zoneedit IP addresses from any browser without actually going into zoneedit the usual way. You simply enter this link (it's one line only):

https://dynamic.zoneedit.com/auth/dy...mydomain2.com, <enter list of ip addresses separated by commas, no spaces...>

Then you'll be prompted for username and password. Then the domains listed in your URL automatically update to your CURRENT IP ADDRESS.

This is documented somewhere at zoneedit.com, but I think their instructions are difficult to understand.

I use wget to do this. I suggest you use 'https' for security, otherwise your username and password are passed to zoneedit in plain text. Here's my script (it's just 2 lines, shebang plus the wget line which probably gets line-wrapped here).

#!/bin/bash
wget -O - --http-user=myusername --http-passwd=mypassword 'https://dynamic.zoneedit.com/auth/dynamic.html?host=mydomain1.com,www.mydomain2.com, ....

The only downside is that my username and password are sitting in the script in plain text. There's probably some workaround for that, but this is good enough for me.

Hope this is helpful.
Apollo
 
Old 01-13-2004, 03:05 PM   #7
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by Apollo77
You can update multiple zoneedit IP addresses from any browser without actually going into zoneedit the usual way. You simply enter this link (it's one line only):

https://dynamic.zoneedit.com/auth/dy...mydomain2.com, <enter list of ip addresses separated by commas, no spaces...>

Then you'll be prompted for username and password. Then the domains listed in your URL automatically update to your CURRENT IP ADDRESS.

This is documented somewhere at zoneedit.com, but I think their instructions are difficult to understand.

I use wget to do this. I suggest you use 'https' for security, otherwise your username and password are passed to zoneedit in plain text. Here's my script (it's just 2 lines, shebang plus the wget line which probably gets line-wrapped here).

#!/bin/bash
wget -O - --http-user=myusername --http-passwd=mypassword 'https://dynamic.zoneedit.com/auth/dynamic.html?host=mydomain1.com,www.mydomain2.com, ....

The only downside is that my username and password are sitting in the script in plain text. There's probably some workaround for that, but this is good enough for me.

Hope this is helpful.
Apollo
Cool, thanks for the info. Even though my IP changes only when my service goes down or unplugged, etc, nice to maybe have this as a backup for myself until the day I break down and just make my own DNS..
 
Old 01-13-2004, 03:09 PM   #8
Apollo77
Member
 
Registered: Feb 2003
Location: Toronto
Distribution: RH8 / FC1 / Gentoo / Debian / FreeBSD / Centos / Ubuntu
Posts: 182

Original Poster
Rep: Reputation: 35
Whoops, be careful, that first https link in my last post doesn't show up correctly (it's shortened). You may want to actually hit it to ensure you don't miss the characters in the middle of it.

Originally I was hitting zoneedit with that script hourly. I'm guessing they don't want people to do that, although they never complained to me. DynDNS apparently gets upset if you hit them multiple times unless there is a change in IP address. In other words, they want you to run a job that checks before you actually hit them. Anyone know if Zoneedit has any similar policy. For now, I will continue to hit them once daily (maybe 3 or 4 times during my upcoming vacation).
 
Old 01-13-2004, 03:17 PM   #9
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 199Reputation: 199
Quote:
Originally posted by Apollo77
Whoops, be careful, that first https link in my last post doesn't show up correctly (it's shortened). You may want to actually hit it to ensure you don't miss the characters in the middle of it.
Yeah, links get shortened so their not too long or when they are too long. I can either just hold cursor over to see full link or I do actually have power to click [edit] on your post to see actual text in it..

Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job Daily petenyce Linux - Newbie 17 01-04-2006 12:13 PM
updatedb daily cron job TranceDude Linux - Software 12 08-25-2005 01:09 PM
save daily from cron job the whole Web servers data cccc Linux - General 2 09-09-2003 02:28 PM
cron.daily MrJoshua Linux - General 2 03-19-2003 01:09 PM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 03:30 PM


All times are GMT -5. The time now is 10:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration