Running Program Every 2 Minutes with Crontab

Running Program Every 2 Minutes with Crontab

What does

2 * * * *

means in crontab context?

I want to run my program every 2 minutes; is that what 2 * * * * means?

1 Answer

Not quite; that means every 2nd minute of the hour (i.e., 6:02, 7:02, 8:02, etc.). To make it every 2 minutes, use */2 in the first entry:

*/2 * * * * my-script.sh

You can read more about the crontab syntax and available options here at Wikipedia. Ubuntu's got a good overview too.

0

Your Answer

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

David Miller
Author

David Miller

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.