cron job + PHP, why would I get duplicates?

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
Reaction score
13
I have a PHP script that runs through my database, and as it does it's work, it does a log (to a txt file) of it's progress.

When i cron job it (it runs 30 16 * * * blabla blabla.php, supposed to be 16:30 every day), it appears that eventually it starts spitting out duplicate lines in the log file.

Why is that? From what I understand it's not running the same script twice, only once in the cron job. and the duplicate entries don't make sense since everything is processed correctly (from what I can see)

Any ideas?
 
Without looking at the code there's no way of telling what the issue could be.
 
Without looking at the code there's no way of telling what the issue could be.

Well it's pretty simple.

function log_error($input){
//write to the file
}

And as the script executes at certain points I do log_error("sup, here we are now"); type calls. Linear top to bottom. It processes 1 record at a time, and since 1 database record = 1 log_error call, I can't figure out why there'd be multiple lines for the same record. Not to mention a criss cross between records, so before record 1's "end" log_error is written, record 2 started already.

Is it a buffer issue perhaps?
 
Like I said, without seeing your code there's no way anyone can help you. You might have "function log_error($input)" placed somewhere in your code that's causing it to run twice. I have no idea.
 
If you're apprehensive about posting your code then pm it to me ;)
 
Check to see that it is only called once.
Make sure that you reset the variable to an empty string, just in case you append to it b mistake.
 
Top
Sign up to the MyBroadband newsletter
X