Results 1 to 8 of 8

Thread: Performance problem with cron job?

  1. #1
    Junior Member
    Join Date
    Mar 2004
    Location
    Italy
    Posts
    20

    Default Performance problem with cron job?

    Hello,

    I have a Perl program that works fine when I execute it interactively by web.

    If I execute it as a "cron job" without any change, I got randomly some errors,
    all of this type: "Can't execute statement: MySQL server has gone away".

    The program execute select and then delete and insert in a database table.
    The table have about 1000 records.
    I'm on Cpanel22.

    There are some difference of performance between interactive and batch ("cron")
    execution? Is that a timeout problem?

    I really don't know where I have to investigate, because the execution
    of the program directly by browser is absolutely perfect.

    Thank for any help,
    Maurizio Mascheroni
    ----------------------------
    Maurizio Mascheroni - Italy
    http://www.dreamchess.com

  2. #2
    Senior Member sdjl's Avatar
    Join Date
    Mar 2004
    Location
    London, UK.
    Posts
    502

    Default

    Does that error occur every time you execute the perl script via cron?

    David
    -----
    Do you fear the obsolescence of the metanarrative apparatus of legitimation?

  3. #3
    Junior Member
    Join Date
    Mar 2004
    Location
    Italy
    Posts
    20

    Default

    Quote Originally Posted by sdjl
    Does that error occur every time you execute the perl script via cron?

    David
    Yes.
    The program run once a day, some minutes after midnight.
    ----------------------------
    Maurizio Mascheroni - Italy
    http://www.dreamchess.com

  4. #4
    Senior Member sdjl's Avatar
    Join Date
    Mar 2004
    Location
    London, UK.
    Posts
    502

    Default

    How are you calling the cron job?
    -----
    Do you fear the obsolescence of the metanarrative apparatus of legitimation?

  5. #5
    Junior Member
    Join Date
    Mar 2004
    Location
    Italy
    Posts
    20

    Default

    Quote Originally Posted by sdjl
    How are you calling the cron job?
    Simply with:
    perl /home/path_to_program > /home/path_for_log_file
    ----------------------------
    Maurizio Mascheroni - Italy
    http://www.dreamchess.com

  6. #6
    Senior Member sdjl's Avatar
    Join Date
    Mar 2004
    Location
    London, UK.
    Posts
    502

    Default

    mmm, i'm stumped to be honest!
    -----
    Do you fear the obsolescence of the metanarrative apparatus of legitimation?

  7. #7
    Administrator AndrewT's Avatar
    Join Date
    Mar 2004
    Location
    Tulsa, OK
    Posts
    3,640

    Default

    Try running perl /home/path_to_program via SSH and see if it is working properly.

  8. #8
    Senior Member
    Join Date
    Mar 2004
    Location
    California
    Posts
    724

    Default

    Quote Originally Posted by maskeret
    I have a Perl program that works fine when I execute it interactively by web.

    If I execute it as a "cron job" without any change, I got randomly some errors, all of this type: "Can't execute statement: MySQL server has gone away".

    Take a look at the CRON CURL command ... you use "CURL http://www.yourdomain.tld/script_to_call.cgi" as the command line in the CRON statement. CRON then "C"alls the "URL" to run the page. Output, if any, is sent to the email address associated with the domain, so you might want to append " &> /dev/null" to the end of the command line to suppress output.
    Last edited by Frank Hagan; 01-24-2006 at 05:27 PM. Reason: Added "to suppress output" to the last sentence

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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