1

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
  • next time read the man or one of the numerous questions asked here in the same topic – asdmin Oct 29 '09 at 20:44
11

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

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

"every minute" has to be entered like this:

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

| improve this answer | |
  • 3
    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
  • 5
    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
1

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

| improve this answer | |
1

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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