[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron-job



On Wed, 2 Aug 2006, Oliver Jato wrote:

> > Example (which not works)
> > index.php
> > <?php
> >
> > 	// Read last timestamp
> > 	$file_name = "last_mail";
> > 	$file = fopen($file_name, "r+");
> > 	$content = fread($file, filesize($filename));
> >
> > 	$time = time();
> > 	if($file[0] >= $time + $diff) {
> > 		include "mailscript.php";
> >
> > 		// Write time back to file
> > 		fseek($file, 0);
> > 		fwrite($file, $time);
> > 	}
> >
> > 	fclose($file);
> >
> > ?>
>
> either like this, where it would be good if you could register the
> script as a shutdown function, but then you'll have to be aware of the
> difference in behaviour of register_shutdown_function() in differing php
> versions.
> or, if you're lucky, the cli version of php is installed and you can
> call any php script with "php -f yourscript.php".
>

 If you don't have php cli installed on your machine, you can also use
wget to call your script from cron. Check the man page for details on how
to use it. It's very simple.



Reply to: