LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 12-12-2008, 10:22 AM   #1
Treikayan
Member
 
Registered: Oct 2008
Location: Albany Park, Chicago IL
Distribution: RHEL 5.1 i386
Posts: 75

Rep: Reputation: 15
Crontab Question


When I execute crontab -l

I get get this listing for one of the jobs:

5 0-20/4 * * *

I understand the first set is minutes and the second is hours, but what is the "/4?" Does that mean the job runs 5 minutes after the hour every 4 hours between midnight and 8pm?
 
Old 12-12-2008, 10:26 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Nope. It means "run every 4 hours in the range from 0 to 20. An excerpt from man 5 crontab explaining it all:
Code:
Ranges  of numbers are allowed.  Ranges are two numbers separated with a hyphen.  The specified range
is inclusive.  For example, 8-11 for an "hours" entry specifies execution at hours 8, 9, 10 and 11.

Lists are allowed.  A list is a set of numbers (or ranges) separated by commas.  Examples: "1,2,5,9",
"0-4,8-12".

Step  values  can  be  used  in conjunction with ranges.  Following a range with "<number>" specifies
skips of the numberís value through the range.  For example, "0-23/2" can be used in the hours  field
to   specify   command   execution   every  other  hour  (the  alternative  in  the  V7  standard  is
"0,2,4,6,8,10,12,14,16,18,20,22").  Steps are also permitted after an asterisk, so if you want to say
"every two hours", just use "*/2".
 
Old 12-12-2008, 10:41 AM   #3
Treikayan
Member
 
Registered: Oct 2008
Location: Albany Park, Chicago IL
Distribution: RHEL 5.1 i386
Posts: 75

Original Poster
Rep: Reputation: 15
Your response looks like what I explained in my first post (except the 5 minutes part). And, 0-20? Doesn't that mean midnight - 8pm?
 
Old 12-12-2008, 10:54 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Oh yes. Sorry. I read your post too quickly! Indeed the job will run at 00:05, 04:05, 08:05, 12:05, 16:05, 20:05. Hours in crontab are in the 24-hours format.
 
Old 12-12-2008, 04:16 PM   #5
Treikayan
Member
 
Registered: Oct 2008
Location: Albany Park, Chicago IL
Distribution: RHEL 5.1 i386
Posts: 75

Original Poster
Rep: Reputation: 15
Thumbs up

Cool, thanks.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab question stefaandk Linux - Newbie 1 06-21-2005 08:31 AM
crontab question linuxtesting2 Linux - General 5 09-21-2004 05:54 PM
Crontab question mikeshn Linux - General 3 09-06-2003 07:26 PM
crontab question WeNdeL Linux - Newbie 1 03-06-2003 11:24 AM
Crontab Question linear Linux - Software 4 01-11-2003 03:42 AM


All times are GMT -5. The time now is 10:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration