Crontab every 2 hours

Solved
Hello,

I would like to run a script from crontab every 2 hours, another every 2 hours and 5 minutes, and finally one more every 2 hours and 10 minutes, and I can’t remember how to do it.

Thanks in advance.

2 answers

  • Votes
  • Date
  • Descending date
  1. Moderator
    oops, you're right ;-) I got the wrong field
    0 */2 * * * script.sh

    --
    106485010510997108
    1. You're welcome :)
  2. Moderator
    Hello,

    every 2 hours means at an interval of 2 hours
    if I start at 0 it gives 0 2 4 ....
    */2 * * * * script.sh
    on the other hand if you want every day at 2:05
    5 2 * * * script.sh

    --
    106485010510997108
    1. Hi,

      Are you sure */2 * * * * script.sh doesn't execute it every 2 minutes???

      Because when I do */1 * * * * myScript it executes it every minute.
    2. You need to put it at the next star ;) * */1 * * *
    3. * */1 * * * = every minute ;-)
      you need 0 */1 * * * to have that every hour and it comes back to 0 * * * *
      every 2 hours => 1 */2 * * * it executes every 2 hours after 1 minute