View Single Post
Old April 27th, 2008, 3:53 AM   #1 (permalink)
vAMP
Registered User
Seasoned Poster
 
Joined in Feb 2008
Lives in Kingdom Of Saudi Arabia
Hosted on i have my own server :)
49 posts
Gave thanks: 1
Thanked 3 times
how can i make php files run in cron jobs?

Hi all

i wrote this code to delete all files that last accessed was after 1 hour ..

it works great if i run the file manually from the browser but it doesn't if i use cron jobs !

i don't know if there is some rules or something ..

PHP Code:
<?
function cleantmp() {
 
$seconds_old 60*60;
$directory "/home/***/public_html/temp";
if( !
$dirhandle = @opendir($directory) )
return;
 
while( 
false !== ($filename readdir($dirhandle)) ) {
if( 
$filename != "." && $filename != ".." && $filename !=".htaccess" ) {
 
$filename $directory"/"$filename;
 
if( @
filemtime($filename) < (time()-$seconds_old) )
 @
unlink($filename);
 }
 }
 }
cleantmp();
?>
so how can i make it works with cron jobs?
thx all
vAMP is offline   Reply With Quote