Cron Jobs

Discussion in 'Site & Server Administration' started by SimThePhpCoder, Jan 14, 2011.

  1. #1
    I need cron jobs to run file every xx seconds. How can I do this? ;]
     
    SimThePhpCoder, Jan 14, 2011 IP
  2. asdirc

    asdirc Active Member

    Messages:
    275
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    First, i don't think your host provider would accept this. Second, to answer you question you can make a cron that runs let's say every minute and in the script you can add a code that recalls your file every x seconds, but be careful no to start more loops, i managed to do this creating also a script that kills the previous cron (that was run the previous minute), or you can think to something similar.
     
    asdirc, Jan 17, 2011 IP
  3. otshare

    otshare Peon

    Messages:
    70
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    As asdirc said the host provider may not allow you to run a cron job or even if they allow they may want to know the purpose and frequency of the job. So just check with them before going ahead. Now if they are happy and you are ready then you can do the following (steps using hostgator cpanel):

    1. login to your control panel
    2. Go to the last section called Advanced
    3. Click on Cron Jobs
    4. Select timing as appropriate and give your file which you want to run.

    hope this helps
     
    otshare, Jan 25, 2011 IP
  4. anta

    anta Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    Digital Goods:
    1
    #4
    Can our hosting account suspended for using too much CPU?
     
    anta, Jan 26, 2011 IP
  5. mysqlxpert

    mysqlxpert Greenhorn

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    It depends on your hosting provider, in most cases they at least warn you.
     
    mysqlxpert, Jan 26, 2011 IP
  6. otshare

    otshare Peon

    Messages:
    70
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You should ask your provider first. Becuse if you want to run the job every xx secs and the job is resource consuming then they will want to know more detail. Also Cron jobs are usually create by super users and i believe they run using that users privileges...but not sure about that. If that is the case, then I am sure hosting provider will ask questions.
     
    otshare, Jan 26, 2011 IP