Closed Thread
Results 1 to 5 of 5

Thread: Cron Jobs

  1. #1
    vrepublik is offline x10Hosting Member vrepublik is an unknown quantity at this point
    Join Date
    Nov 2011
    Posts
    1

    Cron Jobs

    Hi, I'd like to run a PHP cron script: http://www.virtualrepublik.net/pages/cron.php, every day at 00:00 GMT but I have been having some problems with the commands to run the file.

    Would you be able to give me a command example or set it up for me?

    Regards

  2. #2
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Cron Jobs

    cPanel has a cron job manager. I would recommend running it at 23:59 or something slightly before then, because usually on a shared hosting company everyone runs their cron job at 00:00, so it can lag a bit. Not sure what it like on x10hosting, though.
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  3. #3
    cybrax's Avatar
    cybrax is offline x10 Elder cybrax is on a distinguished road
    Join Date
    Aug 2009
    Location
    UK
    Posts
    699

    Re: Cron Jobs

    Regular Cron problems

    1. the command string is wrong, there must be space between php and /home (/php /home/ = good , /php/home/ = wrong)

    /usr/bin/php /home/your_username/public_html/some_folder/cron_job_script.php

    2. the cron account has limited permissions, so not all functions are avaialable to a script such as mail()

    3. you cannot run cron jobs every minute on the free accounts, I believe the lower limit is 15 minute intervals

    Running cron jobs at minutes past the hour is also good practice as callummacrae suggested to avoid slowing the server up.
    The code must flow.
    Project 157: Latest UK Jobs direct to your mobile phone
    New Domain under construction: Lovelogic.net
    home for some new projects that we can't keep here ;)


  4. #4
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Cron Jobs

    It doesn't really slow the server up - as a cron job runs, it is added to a big list of cron jobs which are then ran in order (as opposed to being ran all at the same time, which could take out the server). As 00:00 is so popular, your cron job could be added quite far down a huge list and so there will be a delay. I don't know how they're ordered (or collected, w/e), but my first guess would be by username - in which case "vrepublik" isn't a great username to have ;-)

    Again though, I'm not sure, and I don't even know whether it applies on x10hosting.
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  5. #5
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Cron Jobs

    Code:
    /usr/bin/php -q  /home/igor/public_html/pages/cron.php >>/home/igor/public_html/pages/cron_log.txt 2>&1
    1. Replace 'igor' with your cPanel username

    2. This logs any errors or output to cron_log.txt which helps with debugging, etc. By adding an echo command outputting the time/date will keep a record of the file running.

    3. Depends on where you got the cron file, if you did not write it yourself. Some scripts require a special variable to be added to the URL when run from the web and these cron jobs need to be run using wget.
    Nothing is always absolutely so.

Closed Thread

Similar Threads

  1. Cron Jobs
    By johnpleasedwomen77 in forum Free Hosting
    Replies: 0
    Last Post: 04-26-2011, 07:12 AM
  2. cron jobs
    By damiththilaka in forum Feedback and Suggestions
    Replies: 1
    Last Post: 08-30-2009, 10:45 AM
  3. Cron Jobs help
    By thund33r in forum Free Hosting
    Replies: 10
    Last Post: 08-28-2009, 03:04 PM
  4. Cron Jobs - How often is OK ?
    By ghjklasd in forum Free Hosting
    Replies: 4
    Last Post: 02-04-2008, 04:03 AM
  5. cron jobs
    By jinx001 in forum Free Hosting
    Replies: 4
    Last Post: 12-05-2007, 09:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers