Closed Thread
Results 1 to 8 of 8

Thread: Problem with cron

  1. #1
    xprototipe19 is offline x10Hosting Member xprototipe19 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    6

    Problem with cron

    Hello,

    I have a problem, when I give a mission for cron (execute a script php) makes it but at the end of some instant mission abolishes all alone.
    Why? How to avoid it?

    Thank you for your assistant.

  2. #2
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Problem with cron

    Could you please be a little more specific? Does the cron not run at all? Is there any errors?

    This may also be of interest:
    Note that if you have two crons there must still be at least five minutes in between them.

    Consider these scenarios:
    Quote Originally Posted by Scenario 1
    cron 1 run: 5, 15, 25, 35 etc - cron 2 run: 0, 10, 20, 30 etc
    Quote Originally Posted by Scenario 2
    cron 1 run: 5, 15, 25, 35 etc - cron 2 run: 7, 17, 27, 37 etc
    Scenario 1 would work, as they alternate every 5 minutes.

    Scenario 2 would NOT work, as cron 2 would attempt running only 2 minutes after cron 1 was run. This would result in both crons being removed. Same applies if you set one single cron to run more often then every 5 minutes.
    Last edited by Anna; 02-08-2011 at 01:03 PM.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  3. #3
    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,633

    Re: Problem with cron

    Remember, cron jobs have to be 5 minutes apart. The system will delete all your cron jobs if
    a) any job runs more often than every 5 minutes
    b) two jobs go off withing 5 minutes of each other, ie job1 runs on the hour and job2 runs every half hour at 0 and 30

    If that is not the problem, try making your command line look like:

    Code:
    /usr/bin/php /home/me/public_html/test.php   >>  /home/me/public_html/test_log.txt 2>&1
    then you can see any output or errors in test_log.txt
    Nothing is always absolutely so.

  4. #4
    xprototipe19 is offline x10Hosting Member xprototipe19 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    6

    Re: Problem with cron

    Thank you for your answers.

    Then, I have 2 spots cron, one updates the number of connected every 5 minutes.
    And the other updates a number every hour.

    In fact quite everything works very well, then suddenly nothing more does not put itself has in the daytime, I thus go to see my spots cron and they are not any more :/

    Nevertheless there are no errors

  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,633

    Re: Problem with cron

    Then you have to adjust your cron setup.

    1. You can make it one job/script, every 5 minutes which combines the two scripts. Script always does job1 and checks the time to decide if it does job2.

    2. If you do not mind having the 5 minute script skip once an hour,

    0 * * * * HourlyJob
    5,10,15,20,25,30,35,40,45,50,55 * * * * FiveMinuteJob

    3. Combination of #1 and #2, adjust the Hourly job to include the tasks done by the FiveMinuteJob

    #1 and #3 require that you know what your cron jobs do/PHP.
    Nothing is always absolutely so.

  6. #6
    xprototipe19 is offline x10Hosting Member xprototipe19 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    6

    Re: Problem with cron

    Then we cannot have several spots for cron?
    Nevertheless I respected rules.
    It's a pity, I would try to group together my 2 spots.
    In fact I am novice in this system of cron :p
    Of the blow I found very practical that the host suggests programming the frequency an hour etc.

    Thank you for your help.

  7. #7
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Problem with cron

    you can have several spots, as long as there's no crons that run within 5 minutes of another.

    Prime Membership, at $4.95 / year would allow the crons to run every minute, but not the basic free package
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  8. #8
    xprototipe19 is offline x10Hosting Member xprototipe19 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    6

    Re: Problem with cron

    Ah yes, it is good, I understood

    Thank you still for your answers.

Closed Thread

Similar Threads

  1. cron job problem
    By pacerier in forum Programming Help
    Replies: 1
    Last Post: 09-18-2009, 11:20 AM
  2. Cron job problem . . .
    By n3v3rl0v3 in forum Free Hosting
    Replies: 4
    Last Post: 06-10-2008, 05:12 AM
  3. [cron problem]php-cron command not found
    By N4rk0 in forum Free Hosting
    Replies: 1
    Last Post: 01-31-2008, 11:51 AM
  4. cron problem
    By CJM1682 in forum Programming Help
    Replies: 5
    Last Post: 01-17-2008, 06:46 AM

Tags for this Thread

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