- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Another Perl Brainbuster
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 08:29 AM
01-24-2003 08:29 AM
it works fine from the command line but not from cron (since the env resets). The workaround is to run the cron as root and have a side-script that does and su - oracle and runs the script.
I have tried putting vars into the ENV hash in multiple ways and while it looks correct, the system is not reading them properly.
ex. ENV{ORACLE_HOME)='
ENV{ORACLE_HOME)="
Is there a way from within a perl script to leave the script and set the shell environment and re-enter the script or set the env from within the script?
Any help would be generously appreciated.
Thanks
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 08:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 08:43 AM
01-24-2003 08:43 AM
Re: Another Perl Brainbuster
BEGIN {
$ENV{ORACLE_HOME} = "/path/to/your/oracle/home";
}
It could be that the connect call is done /before/ the environments are set, which busts the procedure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 08:44 AM
01-24-2003 08:44 AM
Re: Another Perl Brainbuster
$ENV{"ORACLE_HOME"}="xxx/yyy";
$ENV{ORACLE_SID}="demo";
Now make your system call and all will be well.
Plan B:
Don't use that su - oracle stuff but rather use su oracle.
Both Oracle's .profile and your wrapper shell script should source a file (e.g. /usr/local/bin/oraenv.sh) that sets and exports any needed env vars but does not contain an exit or return. .profiles often contain commands which expect an interactive environment. This causes problem when jobs are croned.
e.g.
#!/usr/bin/sh
PATH=${PATH}:/usr/local/bin
export PATH
. /usr/local/bin/oraenv.sh
/usr/bin/perl myorascript.pl
STAT=${?}
exit ${STAT}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2003 09:24 AM
01-24-2003 09:24 AM
Re: Another Perl Brainbuster
. /
and it worked like a charm. Thanks a lot.
FYI: I meant to say $ENV previously and i said ENV.
Sorry A. Clay