I've found a perl script online that I configured to delete all files in my cache directory:
$BACKUP_DIR = "/home/mysite/apps/myapp/current/mycache";
# Read directory (ignoring . and ..)
opendir(DIR,"$BACKUP_DIR") || die "opendir $BACKUP_DIR failed";
@files = grep(!/^\.\.?$/,readdir(DIR));
closedir(DIR);
# delete all files in directory
foreach $f (@files)
{
system("rm $BACKUP_DIR/$f");
}
In my crontab I have the following:50 19 * * * /usr/bin/perl /home/mysite/apps/myapp/clear_cache.pl
I've changed the permissions on the script, and directory to 777 for testing purposes to rule that out.I don't get any email with an error, but my script doesn't clear out the directory. If I run the perl script by itself, it works fine. Any ideas? Thanks for any help.