SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Further Cron

  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Just been reading the below thread on Cron and wanted to make sure I was about to do things correctly be causing potential havock with the server.

    I have a number of php scripts which fetch new data every 2 hours and write to a cache file. Problem is that the occasional user (1 every 2 hours) get a very slow page load.

    Hence I would like to automatically load the page every 2 hours behind the scenes to prevent this - hence Cron.

    Hostrocket are my host and the have a Cron Tab control in the Cont Panel.

    To simple call the pages with the scripts in to execute is this the correct command:

    php /www/username/directory/file.php > /dev/null

    ?

    How do I set my time settings to work every two hours ?

    0 * * * * - This I believe is every hour - what is correct for every 2 hours?


    Thanks for the help.

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know it doesn't look nice, but I don't know of a better way at the moment
    0 0,2,4,6,8,10,12,14,16,18,20,22 * * *
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  3. #3
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    If you are on the new servers (not the alabanza ones) then this is your crontab:

    0 */2 * * * php /home/username/public_html/directory/file.php > /dev/null

    -Peter McNulty

  4. #4
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers for the info - yes I'm on the VDI ones.

    Is there a problem with running more than 13 cron jobs on these servers - I have noticed that when I try and put more in through the Cron Tab Page that they are not added - I need to run 20.

    Cheers

  5. #5
    <? echo "Kick me"; ?> petesmc's Avatar
    Join Date
    Nov 2000
    Location
    Hong Kong
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    There should be a problem, can you please send in a trouble ticket and we'll submit it to cpanel if we can't find the problem.

    Also to temporairily fix it read this:

    http://www.codingclick.com/article.php/aid/17

    Sorry for the self advertising....

  6. #6
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Will do - cheers!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •