Operating System - HP-UX
1832214 Members
2333 Online
110041 Solutions
New Discussion

Strange behaviour of cron

 
SOLVED
Go to solution
Kalin Evtimov
Regular Advisor

Strange behaviour of cron

Hi!
I am really confused with a problem that I have now. I have a perl script, that opens a file and writes something in there. I run the script as user oracle from the command line and everything works fine. But when I do the same command from cron, for the same user, I get error message "Permission denied" when it tries to open the file to write. I tried changing permissions and so on, but no change, works from command line, does not work from cron. What is wrong here?

Thank you!
2 REPLIES 2
Peter Godron
Honored Contributor
Solution

Re: Strange behaviour of cron

Kalin,
who is the cronjob running as?
If it is the oracle user, please remember that cron does not use the login file, so your environment is going to be different.
Please ensure you specify all variable you need within your script. For example $ORACLE_HOME would not be know, unless specified within the script. So you may write to $ORACLE_HOME/test but that translates into /test !
Kalin Evtimov
Regular Advisor

Re: Strange behaviour of cron

Thank you, Peter, you were on the right way. When I changed the path to the file to absolute path, it worked properly.