On 05/26/2012 12:33 PM, Kwaku Addo Ofori wrote:
I need some help. I've just finished my script and a manual test is fine.
Basically, it's a script that gets the PID of some selected process and
lists all the open file descriptors for the processes pipes this to a file.
Problem is, when I run the script manually it works well and writes the
file descriptor info to the log file but when I put this same script in
cron it can't log to the file.
I know this is a permissions problem and I've played around with the
permissions but it still can't log to the file when the script is run from
cron. Any idea on how to debug this?
Ideas:
1. Create a world-writable directory and have your script put its log
file there. This is okay for development/ test, but is not secure.
2. Figure out what user/group cron runs your script under (write a test
script using #1, above), create a directory owned by that user/ group,
and have your script write its log there.
3. man cron(8) on my system (Debian 6) says that cron will mail the
output of the job to a configurable user. So, instead of writing to a
log file, have your script write to STDOUT and make sure cron can send
e-mails.
4. Set the setuid bit on the script (not secure; might not work under
cron).
Please let us know what you figure out.
HTH,
David
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/