Search code examples
unixcronjobs

Starting a cron job at 30 minutes in Unix


I want to run a cron job for every 2 minutes from 9:30 to 12.How should I do it?

Is this correct? Where should I add 30?

*/2  9-12   *   *   *

Solution

  • You'll actually need two cronjobs. Add 30-59 in the place of the first asterisk, for execution from 9:30 until 10: 30-59/2 9 * * *. And then a second one for execution from 10:00 until 12:00 */2 10-12 * * *

    Easy tool to check: http://cronchecker.net/check?statement=30-59%2F2+9-12+++*+echo+yep So the whole thing will be something like:

    30-59/2 9 * * * echo yep
    */2 10-12 * * * echo yep