Jump to content

scheduled tasks fail when deleting


raphael75

Recommended Posts

I have a PHP script that runs in a WIMP environment. The script contacts several remote locations, retrieves data, and then attempts to insert it into our MySQL database.

 

The script is set to run each morning at 5:45am, 6:42am, and 7:42am.

 

The steps:

  • contact store
  • get data
  • delete all old data present for the current store for the current day
  • insert new data

 

I have the script log what it's doing.The problem is that more than half the time when it runs on the scheduled task, it contacts the 1st store and the script stops working when it tries to delete the old data.

 

**However, when I manually run it from the command line it always works.**

 

What could cause the script to stop working when run as a scheduled task?

 

I'm not sure if this matters, but the table contains over 2 million rows.

 

Thanks!

 

Link to comment
Share on other sites

best guess is the php.ini settings are different between running as a scheduled task and via the command line and you are running up against the max_execution_time value.

 

do you have php's error_reporting set to E_ALL and log_errors set to ON so that all php errors will be logged? also, are you checking if each query is failing and logging the reason why?

 

you could also log the ini_get('max_execution_time'); value to see if it is different between running as a scheduled task and via the command line. you could also capture and log/store to a file the phpinfo(INFO_GENERAL) output to see if any php.ini is being used and/or log/store to a file the complete phpinfo() output and compare them to see if there are any differences.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.