Cron job problems

exharrison

2[H]4U
Joined
May 24, 2001
Messages
2,956
I hope I put this where it belongs as I figure the more experienced Unix users would know this.
Anyway, I have a set of log files and I wrote a script to go through and pull out information from these. The script then uses sendmail to send it to a specified address. The script does all this.
However, I have to run this on a schedule, so I set up cron. Only problem is the script won't read or write to any files when run through cron. Any suggestions?
This is a perl script by the way.
 
You are setting up the cron job under a user that has access to the files correct?
Also, make sure you have the #! line at the top of your perl script
 
Xipher said:
You are setting up the cron job under a user that has access to the files correct?
Also, make sure you have the #! line at the top of your perl script

Yeah, permissions were correct. I should have also said that the script runs fine when manually executed, so the #! wasn't a problem.
But I did figure out my problem. I had just not thought to realize that the script when manually executed looked for the file by a relative path which worked from the cgi-bin, but the cron job was running it from my home directory. Even if I changed the directory in the script it still looked in the home directory. I just had to use full paths.
Thanks for your help.
 
Back
Top