http://qs1969.pair.com?node_id=134891


in reply to Using Cron to Run Script

I ran into a similar problem once with a script that was making backups of files. It ran correctly from the command line, but didn't run correctly from cron. To be honest, I never really did figure out why it didn't work in the cron, but I ended up with a work-around that solved the problem. I don't have a Linux machine at hand, so I haven't tested this to make sure that it will work in your situation, but it worked for me with my backup script.
$logdir = "/whatdir/"; opendir(LOGDIR, $logdir) or die "Can't open $logdir: $!\n"; chdir $logdir; foreach $file ( grep {-f && (-M > 5)} readdir(LOGDIR) ) { unlink $file; } closedir(LOGDIR);
As I said, I haven't been able to test that to confirm that it will work in your situation, but the situation I had was very similar, and it worked for me.

HTH
___________________
Kurt