Help me setup correct cron job that working
Posted by: basketmen
Posted on: 2007-12-10 22:16:00
i am confuse where correct tutorial for using cron job, i had looking dreamhost wiki and this forum but i still cannot setup working cronjob
i setup cronjob in dreamhost panel --> goodies --> cronjobs
Command to run : /home/.juice/username/domain.com/directory/files.php
When to run : Hourly
this is the file that need to call from cron job
<?php
$dir = "tmp_cvrt_videos/";
// Files older than this number of hours will be deleted
$age = 1; // Hours
$threshold_stamp = time() - $age*3600;
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if (is_file($dir.$file))
{
//echo "$file was last accessed(created): " . date ("F d Y H:i:s", filemtime($dir.$file))."<br />";
if ($threshold_stamp > filemtime($dir.$file))
{
// delete file
@unlink($dir.$file);
//echo " Delete file: $file <br />";
}
}
}
closedir($dh);
}
}
else echo "No Files Dir found";
?>