Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
NeilR is on a distinguished road
 
Posts: 2
Join Date: Jul 2012
Location: Australia
Default Cron not working for me - 07-12-2012, 09:11 AM

Hi,

I am a free member trying to get a simple Cron job that adds some text to a file every so often (e.g. 10 minutes), but cannot get it working.

Here is the php file:

Code:
<?php

chdir('/home/axxxxxxx/public_html/schedcdrs/');

$fileout = 'output.txt';
 
$fhout = fopen($fileout, 'a') or die("cannot open output file $fileout");
 
fputs($fhout, "hello");
 
fclose($fhout);
 
 
?>
and the Cron wizard setup:
*/10 * * * * php -f /home/axxxxxxx/public_html/schedcdrs/cron.php that creates the output file in the same directory

I have also tried using an intermediary PHP file to invoke the target file:
Code:
<?php 
file_get_contents('http://xxxxxxx.netne.net/schedcdrs/cron.php');
?>
as proposed by someone in the forum.

I cannot get either to work (nothing is written to the output file), although they do work using manual browser access.

My understanding is that the Cron feature is available to free members except that it cannot be used for internals for less than 5 minutes.

Can anyone help please,

Regards,

NeilR
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
d3iti's Avatar
Super Moderator
d3iti is on a distinguished road
 
Posts: 6,537
Join Date: Jul 2009
Location: Spain
Default 07-12-2012, 10:39 AM

Hello,

If this does not work manually, maybe the problem is not with CRON.

Try using a file with another extension to txt and check that you have permission to create / write to the file and folder.


Recuerda realizar copias de seguridad de tus sitios web. Si este mensaje te ayudó puedes pulsar sobre el botón karma
Reply With Quote
(#3 (permalink))
Old
Junior Member
NeilR is on a distinguished road
 
Posts: 2
Join Date: Jul 2012
Location: Australia
Default 07-12-2012, 12:39 PM

Hi d3iti,

Thanks for your response.

I don't think I explained myself properly, the php script did work in manual browser mode.

Also, the permissions were all set up with #777 for folders and executables and 666 for text file..
public_html Directory 4096 axxxxxxx axxxxxxx rwxrwxrwx
schedcdrs Directory 4096 axxxxxxx axxxxxxx rwxrwxrwx
cron.php PHP script 203 axxxxxxx axxxxxxx rwxrwxrwx
output.txt Text file 0 axxxxxxx axxxxxxx rw-rw-rw-

I also tried it with a different extension (CSV) with the same results.
output.csv CSV File 0 axxxxxxx axxxxxxx rwxrwxrwx

BTW, if any errors are produced during the Cron job, are they stored anywhere?

Regards,

NeilR
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com