Re: Environment variables of daemon processes (219 Views)
Reply
Occasional Visitor
IgnatzMouse
Posts: 4
Registered: ‎11-26-2013
Message 1 of 7 (259 Views)

Environment variables of daemon processes

Folks'ses,

 

we have a strange problem here on HP-UX B.11.31: we have a daemon process, started by rc which in turn starts another process upon receiving some input over the network.

 

For some strange reason this 2nd process no longer has any reasonable environment set up, esp. PATH seems to be gone.

It used to work without a problem by now something has gone amiss.

 

Can anyone help identify the change that might cause this strange behaviour?

 

Thanx

 

PS: I'm not the admin I only use the box and the admins say they didn't change anything (as usual ;)

Acclaimed Contributor
Dennis Handly
Posts: 25,285
Registered: ‎03-06-2006
Message 2 of 7 (247 Views)

Re: Environment variables of daemon processes

>no longer has any reasonable environment set up

 

Why would you expect anything in the environment for a demon?  You should be using absolute paths.

Can you dump the environment for your first process and check what's missing for the second.

Occasional Visitor
IgnatzMouse
Posts: 4
Registered: ‎11-26-2013
Message 3 of 7 (240 Views)

Re: Environment variables of daemon processes

Thanx Dennis, for your answer.

 

  1. I'm expecting something because it used to work (I'm currently taking over long established software);
  2. I did dump the environment in the 2nd process and its PATH variable only contains /sbin.

 

Using absolute paths is an option, I know, but the software is supposed to run on HP-UX, SUN, AIX, ... so I'm not sure if it is such a good idea...

Acclaimed Contributor
Dennis Handly
Posts: 25,285
Registered: ‎03-06-2006
Message 4 of 7 (234 Views)

Re: Environment variables of daemon processes

>I did dump the environment in the 2nd process

 

Anything besides PATH?  What about the first process?

Occasional Visitor
IgnatzMouse
Posts: 4
Registered: ‎11-26-2013
Message 5 of 7 (232 Views)

Re: Environment variables of daemon processes

DDFA=0
DHCPV6CLNTD_ARGS=''
DHCPV6D=0
DHCPV6SRVRD_ARGS=''
ERASE=^H
ERRNO=2
FCEDIT=/usr/bin/ed
IFS='
'
INETD=1
INETD_ARGS=''
INIT_STATE=3
LANG=C
LINENO=1
MAILCHECK=600
MROUTED=0
MROUTED_ARGS=''
NTPDATE_SERVER=''
OPTARG
OPTIND=1
PATH=/sbin
PPID=3093
PRE_U95=true
PS2='> '
PS3='#? '
PS4='+ '
PWD=/sam/dev5bdevn/courier
RANDOM=16935
RWHOD=0
SECONDS=0
SENDMAIL_RECVONLY=0
SENDMAIL_SENDONLY=0
SENDMAIL_SERVER=1
SENDMAIL_SERVER_NAME=''
SHELL=/usr/bin/sh
SNMP_HPUNIX_START=1
SNMP_IPv6_START=1
SNMP_MASTER_START=1
SNMP_MIB2_START=1
SNMP_NAA_START=0
SNMP_TRAPDEST_START=1
SSLSOCKET=7
TERM=unknown
TMOUT=0
TZ=GMT
XNTPD=1
XNTPD_ARGS=''
_=/sam/dev5bdevn/courier/rc_tcpip

 don't have acces to the 1st process

Acclaimed Contributor
Dennis Handly
Posts: 25,285
Registered: ‎03-06-2006
Message 6 of 7 (224 Views)

Re: Environment variables of daemon processes

Since the rc(1m) scripts have to run without /usr mounted, I would think that PATH=/sbin is reasonable.

What other path components do you think you need?

If you want more, you will have to set them yourself.

Occasional Visitor
IgnatzMouse
Posts: 4
Registered: ‎11-26-2013
Message 7 of 7 (219 Views)

Re: Environment variables of daemon processes

I would need at least /usr/bin, because the process does, amongst many other things, a system("cp -r .."); which fails now.

 

The confusing thing though is, that it used to work, and "nobody changed anything".

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.