How to run cron in seconds

Discussion in 'Site & Server Administration' started by deriklogov, Aug 24, 2009.

  1. #1
    I got cron to run at 10,20,30,40 and 50 minutes.
    10,20,30,40,50 * * * *

    but how to make cron run at 10 and lets say 15 seconds, and so on ?
     
    deriklogov, Aug 24, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Minimum limit is every 1 minute.

    However, you can simulate with php by using the sleep command:

    sleep(5); to sleep 5 seconds and then do the next action.
     
    premiumscripts, Aug 24, 2009 IP
  3. gary4gar

    gary4gar Peon

    Messages:
    496
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #3
    same can be done from bash also. run a shell script in background with help of cron and use sleep command to run it say every 2seconds
     
    gary4gar, Aug 24, 2009 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    Yes cron starts from mins its better to use sleep as the above person said
     
    Bohra, Aug 24, 2009 IP
  5. thuankkk

    thuankkk Active Member

    Messages:
    503
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    95
    #5
    Exept you have a dedicated server, I don't recommend you to run cron job every seconds.
    It may cause high server load.
     
    thuankkk, Aug 26, 2009 IP