Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run a cron job every 2 minutes (*/2) but only for the first 30 minutes of every hour, with pause of 30 minutes between the runs.

For example, something like:

  • From 10h00 to 10h30: run every 2 minutes
  • From 10h30 to 11h00: nothing to run
  • From 11h00 to 11h30: run every 2 minutes
  • etc...

How can I achieve this result?

share|improve this question
    
is this homework? You could wrap the command in a script to loop 15 times {call command, wait 2 minuets} – richard Sep 14 '12 at 10:59
up vote 1 down vote accepted

Can you run after the half hour instead of before? If so this should work for you...

30/2 * * * *    

If not you would have to designate each of the minutes you want it to run...

2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 * * * *    

Not sure if your hourly was supposed to recur throughout the day or not but I assumed so.

share|improve this answer
    
Perfect. Simple way, i was thinking for something much more complicated instead of thinking a simple way... thanks – Hugo ferreira Sep 14 '12 at 11:23
    
I brain farted and had an extra 0 in front... not even sure how it ended up there, lol. I corrected it though so make sure what you took from it matches. – Omnikrys Sep 14 '12 at 11:50

You must log in to answer this question.

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