Crontab and PHP help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Crontab and PHP help
# 1  
Old 12-28-2009
Crontab and PHP help

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
# 2  
Old 12-28-2009
Check if the file which you are writing to has any permission problems .
# 3  
Old 12-28-2009
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.
# 4  
Old 12-28-2009
Anyway make sure in the script you always use full path names and explicitly set some env variables if used
# 5  
Old 12-28-2009
Also try capturing the error and chk
Code:
like 2>&1 | mail -e -s 'err' xyz@abc.com


Last edited by Yogesh Sawant; 12-31-2009 at 01:48 PM.. Reason: added code tags
# 6  
Old 12-29-2009
You will have to bear with me, I am new to this, but i assume the line will look something like this:-
Code:
10 11 * * * php path/path/script.php like 2>&1 | mail -e -s 'err' xyz@abc.com

Sidabm

Last edited by Yogesh Sawant; 12-31-2009 at 01:47 PM.. Reason: added code tags
# 7  
Old 12-29-2009
Code:
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
Code:
which php

also the script path which you are showing please use the full path

HTH,
PL
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Strange bug crontab command line php / bcompiler

Hello everyone, I have a small problem that I'm stuck for several days and I do not go out. I tell you, I have a php script that I want to run crontab, it uses a compiled bcompiler file. In my php file if(file_exists("php/Alibrary.phb")){ include_once("php/Alibrary.phb"); What I do... (6 Replies)
Discussion started by: nicolas33770
6 Replies

2. Linux

Run a php file using URL in crontab.

I want to run a php file from a url using cron tab. I am using a webhosting and i give a command like that 9 11 9 2 * wget -O /dev/null here-is-domain-name/cronfile.php but it does not work please tell me why this not work. I think this command must run a "cronfile.php" and i do not want to... (2 Replies)
Discussion started by: ArfanHaider
2 Replies

3. Shell Programming and Scripting

Need help in crontab

Hi, I want to run a shell script for every 3 hours basis starting from 1 AM in the night. Could you please help me out ,how to set a crontab. 0 01 * * * /shell script Thx. (2 Replies)
Discussion started by: kirankumar
2 Replies

4. Shell Programming and Scripting

help in using crontab

i want to run a script automatic in time there us problem coming while i was doing s simple test i do in command prompt cat > cmdfile 50 17 * * * echo "jtgtrgtrgjtrgg" ctrl+d then crontab cmdfile so this echo command should execute on 17:50 i check in /var/spool/cron/crontabs... (3 Replies)
Discussion started by: sayurabh
3 Replies

5. UNIX for Advanced & Expert Users

crontab help

I set up a simple echo script so I know its actually doing its job. * * * * * echo hi >> /home/bob/Desktop/come I have 3 video's I'm trying to play as a playlist at 8 am. I've checked in the terminal and as a regular script that this works fine. Right now I'm just trying to get it working so I'm... (7 Replies)
Discussion started by: cokedude
7 Replies

6. Shell Programming and Scripting

Crontab PHP scripts not ending

when i run the scripts from command line like php ./file.php they run fine and it ends. But i have them running in crontab every 5 minutes and they sometimes dont close. Can i write something to log why or force them to close after a certain amount of time by killing the pid? (2 Replies)
Discussion started by: nitrous
2 Replies

7. UNIX for Dummies Questions & Answers

Using PHP script with crontab (NOOB)

Hi, I am trying to use a PHP script as a test for a cron job. My crontab is 1 line: 30 * * * * /home/www/inc/crontab.php if I test the file through the browser (ie. http://www.domain.com/inc/crontab.php), the PHP script works -- so there is nothing wrong with the PHP script itself or the... (5 Replies)
Discussion started by: Bobafart
5 Replies

8. UNIX for Dummies Questions & Answers

Crontab

Hello everyone I´m trying to edit my crontab, with the -e option and the only thing that appears its a number for example crontab -e enter 75 I need to use crontol +d and appears the message that nothing changes in the crontab. If I use crontab -l appears my list of crons. Can... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies

9. UNIX for Dummies Questions & Answers

Crontab help.

All, I am trying to edit the crontab but I am not able to open it. I just get 863 but nothing opens.I tried crontab -l found some entries. Could some please let me know if I am missing something. I am trying this on my application id. If I do it for my personal Id it works.. Thanks in... (2 Replies)
Discussion started by: venkyA
2 Replies
Login or Register to Ask a Question