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 03-01-2006, 03:00 PM   #1
kyosuke
LQ Newbie
 
Registered: Jun 2005
Distribution: Fedora Core 3
Posts: 9

Rep: Reputation: 0
Cron Job Selective Timing


Hi,

I have a cron job set up that runs every ten minutes. I want to further define its schedule so that it only runs from 7am til 1am, or to put it another way, I want it to NOT run from 1am til 7am. I'm wondering how to put in a code for this in the crontab, as when I tried to put 7-1 for the hour, it rejected it saying 'bad hour'.

Thanks,
-K.W.
 
Old 03-01-2006, 03:15 PM   #2
pljvaldez
Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Squeeze (x86)
Posts: 6,092

Rep: Reputation: 269Reputation: 269Reputation: 269
Can't you just:

0-59/10 0,7-23 * * * /home/myscript.sh etc etc

i.e. 0-59 minutes at 10 minute intervals, at the hours of midnight (0) and 7am-11pm (with the 11pm hour included because you're doing the 0-59 minutes)
 
Old 03-01-2006, 03:23 PM   #3
DarkElf109
Member
 
Registered: Dec 2005
Location: Phoenix, AZ
Distribution: Ubuntu, Debian, Gentoo
Posts: 43

Rep: Reputation: 15
Try the following:

0-59/10 0,7-23 * * * <command>

Should work.

Last edited by DarkElf109; 03-01-2006 at 03:24 PM.
 
Old 03-01-2006, 09:52 PM   #4
kyosuke
LQ Newbie
 
Registered: Jun 2005
Distribution: Fedora Core 3
Posts: 9

Original Poster
Rep: Reputation: 0
Worked.

Seems to have worked. Cron accepted it anyway. I'll just have to check my logs later and see if it has.

Thanks,
-K.W.
 
  


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? dr_zayus69 Linux - Newbie 14 12-01-2004 06:16 PM
CRON Job tommytomato Fedora 12 09-13-2004 12:38 AM
cron job sanjith11 Linux - General 5 07-14-2004 01:06 PM
cron job thesnaggle Linux - Newbie 1 09-19-2003 10:47 AM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM


All times are GMT -5. The time now is 03:47 AM.

Main Menu
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