Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 03-01-2006, 03:00 PM   #1
LQ Newbie
Registered: Jun 2005
Distribution: Fedora Core 3
Posts: 9

Rep: Reputation: 0
Cron Job Selective Timing


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'.

Old 03-01-2006, 03:15 PM   #2
LQ Guru
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

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

0-59/10 0,7-23 * * * /home/ 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
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
LQ Newbie
Registered: Jun 2005
Distribution: Fedora Core 3
Posts: 9

Original Poster
Rep: Reputation: 0

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



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 > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:57 AM.

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