Page 1 of 1

strange cron problem

Posted: Fri Feb 29, 2008 8:28 am
by dannyd
I wrote a script that parses a file and inserts the data into a database. If I run the script once it works fine. However if I run the script while data is in the database nothing gets inserted.

Anyone know what the problem might be ?

Re: strange cron problem

Posted: Fri Feb 29, 2008 8:39 am
by Zoxive
Easiest way is to look at the mysql error you would be getting.

Most likely a unique row, or something similar.

Re: strange cron problem

Posted: Fri Feb 29, 2008 8:44 am
by kryles
yah, check Primary Key or Unique columns to make sure there are no duplicate entries

Re: strange cron problem

Posted: Fri Feb 29, 2008 9:07 am
by dannyd
Actually I used a replace into. The script runs fine when I run it on the command line:

$> php -a ./logs

I entered a line in the crontab file

5 10 *** /usr/local/cron/logs // to run at 10:05am

I changed the time to see if it would run but nothing happens. Any ideas ?

Re: strange cron problem

Posted: Fri Feb 29, 2008 10:20 am
by dannyd
My problem is the cron works on the commandline but doesnt work as a crontab.

apparently the problem is setting environment variables from what I've read. How do I do that ?