3

I'm seeing slashes in some crontab examples, I don't understand what they mean?

Check this one out for example

*/10 * * * * /home/ramesh/check-disk-space

http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

3 Answers 3

9

Depends on where the slashes are at.

The first occurrence is */10 which means every 10 and since it's the minutes column, every 10 minutes. It's shorthand for 0,10,20,30,40,50 in the minutes column.

The second through fourth, if you have to ask on those, hmmm... It's a path to the executable.

3
  • Here is another one I found runs on every 23 minutes past midnight every two hours "23 0-32/2 * * * /myscript" is this consistent with what you said?
    – user893730
    Mar 23, 2012 at 2:47
  • In cron shorthand, the syntax is firstnum-lastnum/interval, with * standing for all available, ie in the minutes column * would equal 0-59. In the hours column, * would equal 0-23, I think the 32 is transposed. For the hours column, 0-23/2 should be the equivalent of */2. So if you wanted to fire something every two hours starting at 6 am and ending at 6 pm, you'd do something like 6-18/2 Mar 23, 2012 at 3:41
  • Perfect, so whatever comes after / is interval
    – user893730
    Mar 25, 2012 at 2:05
0

According to the example you posted, it executes that file, /home/ramesh/check-disk-space at the given time, where */10 means that every 10 minutes, of * * * * (The * means all the possible unit — i.e every minute of every hour through out the year, and follows this order: weeks, monthly, daily, and hourly)

2
  • This is a list of time parameters, whitespace separated -> */10 * * * * and this is a path -> /home/ramesh/check-disk-space which leaves the explanation that */10 is short hand for every 10 minutes and the other is a path to execute a command per the timesettings. Mar 23, 2012 at 1:57
  • It's implied in the question that the user knows what cron is for so I think attempting to draw paralells between it and Scheduled Tasks, while true, is only confusing.
    – LawrenceC
    Mar 23, 2012 at 2:43
-2

Read title of p.7 of linked document "Schedule a Background Cron Job For Every 10 Minutes", also man crontab

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .