1823759 Members
4823 Online
109664 Solutions
New Discussion юеВ

perl and ENV and cron

 
SOLVED
Go to solution
Ratzie
Super Advisor

perl and ENV and cron

I can get the following script to work manually, but when I run thru cron, it errors out:
Could not open /etc/application//voice/.login: No such file or directory

my $file = "/etc/application/$ENV{'ORACLE_SID'}/voice/login";
open LOGINID, "< $file" or die "Could not open $file: $!";
3 REPLIES 3
Christian Tremblay
Trusted Contributor
Solution

Re: perl and ENV and cron

cron is not aware of any set variable like
$ENV
To run your job with cron you need to set them explicitly or run a script in cron that will source oracle's .profile to set the environment properly then run your job.

Chris
Hein van den Heuvel
Honored Contributor

Re: perl and ENV and cron

It's pretty clear that ORACLE_SID is not defined when the script is run through cron.
You may want to start submitting a simple script with just an 'env' command to see what variable are there.

Also... it's a little odd how the error message indicate '.login' while the code sample just shows 'login'. Is that a transription error or really a problem?
If it is typed wrong, then what else might be wrong?

Hein.
Ratzie
Super Advisor

Re: perl and ENV and cron

Your right, I have sourced the env thru the cron command first.
Works like a charm