1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Updating database every 15 minutes.

Discussion in 'PHP' started by silverpanda, Mar 22, 2008.

  1. #1
    Hi, developers.

    I have a problem while developing a website.

    The database of this site should be updated every 15 minutes regardless clients visit or not.
    how can the database be updated periodically without clients' visiting of pages?
    I am wondering cPanel has such ability. but not sure and can't find such ability.

    Please help.
    Thank you.
     
    silverpanda, Mar 22, 2008 IP
  2. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #2
    You need set up a cron tab. ;)
     
    Weirfire, Mar 22, 2008 IP
  3. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #3
    In cPanel, click "Cron Jobs". Then select simple mode. For the command, try something like:

    php -q /home/username/public_html/path/to/file.php
    Code (markup):
    Hope this helps,

    Jay
     
    jayshah, Mar 22, 2008 IP
  4. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #4
    Open SSH:

    
    crontab -e
    
    Code (markup):
    Enter a new line in the end:

    
    */15 * * * * php /directoryoffiletorun/filename.php
    
    Code (markup):
    or

    
    15,30,45,59 * * * * php /directoryoffiletorun/filename.php
    
    Code (markup):
    Peace,
     
    Barti1987, Mar 22, 2008 IP
  5. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #5
    May I ask what you are updating exactly?
     
    LittleJonSupportSite, Mar 22, 2008 IP
  6. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Now you're just being nosey ;) lol
     
    Weirfire, Mar 22, 2008 IP
  7. LimeBlast

    LimeBlast Peon

    Messages:
    81
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Go there to download... http://dd.cron.ru/dbg/downloads.php
     
    LimeBlast, Mar 23, 2008 IP
  8. shamess

    shamess Well-Known Member

    Messages:
    1,127
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    185
    #8
    I'm interested as well. If you're updating things randomly, you probably have bad database design.
     
    shamess, Mar 23, 2008 IP
  9. jkwiz

    jkwiz Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Something like this could be useful for counting users online or something similar. There are things that you can use a database cron for... lol
     
    jkwiz, Mar 24, 2008 IP
  10. shamess

    shamess Well-Known Member

    Messages:
    1,127
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    185
    #10
    You wouldn't want to keep updating the database if there were zero users online though...
     
    shamess, Mar 24, 2008 IP
  11. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #11
    I was just kidding buddy. :)

    Reasons I can think of for running a script to update your database regularly;

    • Removing expired content (Keeping diskspace low and load times down when users view site)
    • Running scripts which are excessive on the servers resources at non-essential times (3AM)
    • Pulling in news stories at specific times from RSS feeds e.g. the closing stock markets, yesterdays news, sports results
    • Downloading the latest spam filters/ scripts for various applications e.g. PHPBB

    I'm sure there's hundreds more.

    I wouldn't say it's bad database design at all to keep your database updated instead of having it update as users join the site. If the database is updating non user activated information then processing the scripts for the database when a user is browsing means that you are causing unneccessary delays on the users browsing of your site.
     
    Weirfire, Mar 25, 2008 IP
  12. shamess

    shamess Well-Known Member

    Messages:
    1,127
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    185
    #12
    Oh, I totally didn't think of those. I can think of lots more now too.
     
    shamess, Mar 25, 2008 IP