Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a cron that needs to run every minute

I tried

1 * * * * php /scripts/cron.php

but seems not to run every minute, why? Since in the minute tab I entered 1 for every minute

but the following runs every minute

* * * * * php /scripts/cron.php
share|improve this question
    
next time read the man or one of the numerous questions asked here in the same topic –  asdmin Oct 29 '09 at 20:44

4 Answers 4

up vote 10 down vote accepted

1 in the first column doesn't mean "every minute", it means "one minute past the hour".

share|improve this answer
    
Ah ok, now I understand, sorry new to crons –  Roland Oct 29 '09 at 15:05

"every minute" has to be entered like this:

*/1 * * * * php /scripts/cron.php

share|improve this answer
1  
You don't need the /1. –  womble Oct 29 '09 at 15:17
    
But it won't throw any errors, right? –  user24393 Oct 29 '09 at 15:20
2  
I prefer the /1, it's more explicit. –  Kamil Kisiel Oct 29 '09 at 15:30
3  
So shouldn't that be */1 */1 */1 */1 */1 for consistency? –  womble Oct 29 '09 at 16:03
    
Not necessarily, that's too much :) Rhe guy is new to crontab and I just wanted to show him how the right syntax for "every something" looks like. There was no need to hit negative rating since there was nothing wrong with the instructions. Difference between personal preferences doesn't mean that one solution is wrong or superior in any way than another ;) –  user24393 Oct 30 '09 at 8:58

The column is the minutes in the hour to run the command, not how often to run

You could go with

1,2,3,4, all the way up to 59 * * * * php /scripts/cron.php if you were bored and wanted to list out every minute manually, or you could just do what you've actually done, the * means "run every time".

Ewan

share|improve this answer

Nice explanation is on wikipedia.org: http://en.wikipedia.org/wiki/Cron#Operators

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.