Crontab every 2 hours

Solved
karine83 -  
 Mohamed-Ali -
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

  1. lami20j Posted messages 21506 Registration date   Status Moderator, Security Contributor Last intervention   3 571
     
    oops, you're right ;-) I got the wrong field
    0 */2 * * * script.sh

    --
    106485010510997108
    29
    1. Mohamed-Ali
       
      You're welcome :)
      0
  2. lami20j Posted messages 21506 Registration date   Status Moderator, Security Contributor Last intervention   3 571
     
    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
    0
    1. karine83
       
      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.
      0
    2. Misoss
       
      You need to put it at the next star ;) * */1 * * *
      0
    3. DavThe
       
      * */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
      0