- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Child process environment variable inheritance
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
03-22-2006 01:37 AM
03-22-2006 01:37 AM
Child process environment variable inheritance
I am trying to understand some strange behaviour that I am getting with a customer's HP-UX machine.
First, some background...
As I understand things, in Unix (generically) when one process invokes a subprocess, that subprocess inherits the environment of its parent process. On the back of that understanding, some description of the problem. I have a scenario where a script scr1.sh invokes a load module LM1 that stays running until you tell it to stop. LM1 then reads a database and processes work requests, which then result in the calling of a new script (scr2.sh), which in most cases either call another loadmodule (LM2) of our own, or, a load module belonging to the product we support (LM_EXTERNAL_1).
Now, with that as a backdrop (calling chain of scr1.sh->LM1->scr2.sh->LM2), I would expect the environment setup in scr1.sh to be available for LM1, scr2.sh and LM2 (and on our own HP and AIX machines, as well as those of most of our customers, this is the case).
The problem is that at one specific customer, the SHLIB_PATH environment variable is not the same when "tested" in scr2.sh, which means that LM2 fails due to "missing Shared Library" errors. Strangely, it seems that SHLIB_PATH is the only environment variable that "gets lost".
Our Scripts use the Bourne Shell if that matters.
Can anyone help me understand what is causing this behaviour, and possibly how to resolve it?
I know a work around would be to hard code the value of SHLIB_PATH in scr2.sh, but scr2.sh represents 100 possible scripts... so I would prefer not to go down that route.
Thanks in advance, points rewarded for every reply...
Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 02:09 AM
03-22-2006 02:09 AM
Re: Child process environment variable inheritance
I'd create a central environment script and source it into the scripts.
You can use sed to turn a comment hash mark # into the command that makes all 100 scripts properly read SHLIB_PATH
You might also find a universal value for SHLIB_PATH that works for that system.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 02:50 AM
03-22-2006 02:50 AM
Re: Child process environment variable inheritance
Kevin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 03:51 AM
03-22-2006 03:51 AM
Re: Child process environment variable inheritance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 01:01 PM
03-22-2006 01:01 PM
Re: Child process environment variable inheritance
Have you checked that the SHLIB_PATH is exported.... export SHLIB_PATH=.....
Also, is there a soft link missing? Does the missing shared library need to be a link file?
regards,
Maria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 09:22 PM
03-22-2006 09:22 PM
Re: Child process environment variable inheritance
Thanks for the suggestions. I got to the bottom of it and here are the details:
My scripts use the POSIX shell and the customer had setup their users to use the ksh by default. The behaviour was explained by the customer usr's $HOME/.kshrc having only the "export sHLIB_PATH=/lib1:/lib2" inside it. It seems that if a ksh process starts a posix-sh process, which in turn starts child process, then the ksh "profile" overlays any inherited environment from the posix-sh process. I put some logic into the $HOME/.kshrc to use some posix-sh defined variables, which if blank defaulted to a valid value, and then set SHLIB_PATH using these.
Problem solved... Issue closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 09:40 PM
03-22-2006 09:40 PM