Sidabm
December 28, 2009, 6:01pm
1
when i run the my php script from Putty command line it works fin, but when in the crontab file it stops after a few results.
Command line is:-
php path/path/script.php
The script downloads a xml file then steps through each url and scrape the price from the sit and writes it to another xml file.
I have searched the internet and can not find any help.
Sidabm
daptal
December 28, 2009, 6:07pm
2
Check if the file which you are writing to has any permission problems .
Sidabm
December 28, 2009, 6:12pm
3
What happens is it seems to wrote the header and the first few records then stops on cron, but from putty it manages to finish the file and write the closing argument of the xml and echo file created.
hongwei
December 28, 2009, 6:46pm
4
Anyway make sure in the script you always use full path names and explicitly set some env variables if used
daptal
December 28, 2009, 7:26pm
5
Also try capturing the error and chk
like 2>&1 | mail -e -s 'err' xyz@abc.com
Sidabm
December 29, 2009, 5:51am
6
You will have to bear with me, I am new to this, but i assume the line will look something like this:-
10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com
Sidabm
daptal
December 29, 2009, 6:09pm
7
10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com
10 11 * * * /usr/bin/php /path/path/script.php ....
Try to also use the full path of php you can get the path of the php by using
which php
also the script path which you are showing please use the full path
HTH,
PL
Sidabm
December 30, 2009, 5:24am
8
I have a problem, now when i log in using putty and type crontab -e ot -l i get permission denied......
Sidabm
December 31, 2009, 4:04pm
9
My host has fixed the permission problem, now just need to look at the old issue....
---------- Post updated at 09:04 PM ---------- Previous update was at 01:27 PM ----------
daptal:
10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com
10 11 * * * /usr/bin/php /path/path/script.php ....
Try to also use the full path of php you can get the path of the php by using
which php
also the script path which you are showing please use the full path
HTH,
PL
Don't know if it was my hosting company resetting my server or following the advice you gave, but it seems to be working now. I think it was the tip you gave me.
Thanks for all your help
Sidabm