LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2010, 09:34 AM   #1
Norwood
Member
 
Registered: Feb 2010
Location: A Smidge South O' Boston
Distribution: Debian
Posts: 41

Rep: Reputation: 15
Exclamation Crontab question (Every few minutes after a certain time)


Hi all,

I am able to get a job to run every x amount of minutes but what I need is to be able to get thsi job to run every x amount of minutes after, say 9am on a certain day.

The only part I'm struggling with is the "after 9am" part. All the other things like day of week and the actual command all work perfectly.
 
Old 03-08-2010, 09:37 AM   #2
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
*/x 9-24 certain_day * * job
 
1 members found this post helpful.
Old 03-08-2010, 09:54 AM   #3
Norwood
Member
 
Registered: Feb 2010
Location: A Smidge South O' Boston
Distribution: Debian
Posts: 41

Original Poster
Rep: Reputation: 15
So I have:

Code:
*/5 9-11 * * 5 command
That will execute the command every five minutes on Fridays?
 
Old 03-08-2010, 11:17 AM   #4
troop
Member
 
Registered: Feb 2010
Distribution: gentoo, arch, fedora, freebsd
Posts: 379

Rep: Reputation: 97
Yes. Two hours between 09 and 11 am. 24 times.
 
Old 03-08-2010, 01:20 PM   #5
nuwen52
Member
 
Registered: Feb 2009
Distribution: Debian, CentOS 5, Gentoo, FreeBSD, Fedora, Mint, Slackware64
Posts: 208

Rep: Reputation: 46
Actually, I ran a quick test on that because I wanted to know what would happen...

crontab entry:
Code:
*/5 11-12 * * * root /home/tests/test0.sh
test0.sh
Code:
#!/bin/sh
DATECODE=`date +%H:%M:%S`
echo $DATECODE >> /tmp/cron_junk.txt
output of cron_junk.txt:
Code:
...
11:50:01
11:55:01
12:00:01
12:05:01
12:10:02
12:15:01
...
12:55:01
As you can see, it actually went until (5 minutes before) 13:00 even though it was expected to end at 12:00. So, what it seems to be is that for every hour that starts with the number specified in the range, the command runs. So, I would expect that "*/5 9-11 * * 5 command" would run every 5 minutes until 12:00, which may not be the desired affect. (Unless I had done something incorrectly.)

Last edited by nuwen52; 03-08-2010 at 01:25 PM.
 
1 members found this post helpful.
Old 03-08-2010, 02:41 PM   #6
Norwood
Member
 
Registered: Feb 2010
Location: A Smidge South O' Boston
Distribution: Debian
Posts: 41

Original Poster
Rep: Reputation: 15
Gotcha, and that actually makes sense now that I think about it.

Man I love this place!
 
  


Reply

Tags
awesome, expert, helpful



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to start crontab every 5 minutes? cola Linux - General 15 12-31-2009 11:00 AM
ntp time 12 minutes slow GregLee Linux - Software 8 09-14-2009 11:22 AM
Crontab Time Differs From Server Time Through Date onesikgypo Linux - Newbie 2 06-08-2009 09:36 AM
Crontab time question thetawaverider Linux - Newbie 3 05-24-2007 10:30 PM
Crontab every 10 minutes Neorio Linux - General 1 11-18-2003 11:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05: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
Open Source Consulting | Domain Registration