System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

/etc/utmp not updated quick enough by inittab respawns

 
SOLVED
Go to solution
Highlighted
Frequent Advisor

/etc/utmp not updated quick enough by inittab respawns

Hello,
I have a "C" process that runs out of inittab (MRupddo). The first thing the process does is look for its entry in /etc/utmp using function getutent()
Unfortunately for some reason, it occasionally only finds the previous "dead" process, and not the one just started up????

It appears that the process is checking /etc/utmp before it has been updated by inittab, so the proccess does not find its own pid...

This is HPUX 11.11

Checking our pid=7404 pid=7350 user=MRupddo id=AMuo line= type=8
the process terminates since it doesnt find its pid in /etc/utmp
then inittab respawns it
Checking our pid=7405 pid=7404 user=MRupddo id=AMuo line= type=8
then inittab respawns it again....
Checking our pid=7406 pid=7405 user=MRupddo id=AMuo line= type=8

until it respawns too fast and is shut down..

I'm hoping this a known problem, and may have a patch to fix it, but I think my patch level is current....

Thanks for any ideas
Gary
5 REPLIES 5
Highlighted
Acclaimed Contributor

Re: /etc/utmp not updated quick enough by inittab respawns

Hi Gary:

My first thought is that the file is buffered and thus you're not seeing "instantaneous" recording.

Does your program call 'setutent()' before looking for the latest entry? It should.

Regards!

...JRF...
Highlighted
Acclaimed Contributor
Solution

Re: /etc/utmp not updated quick enough by inittab respawns

What is your process looking for in utmp(4), ut_id?
Otherwise I wouldn't think demons would care about that file.

Have you tried adding sleep(3) to your program?
Highlighted
Frequent Advisor

Re: /etc/utmp not updated quick enough by inittab respawns

Thanks guys,
I do not call setutent() because when the process respawns it always starts at the beginning of the file.

I am in fact trying to match on utp->ut_pid with my respawned process pid. Unfortunately /etc/utmp has the wrong ut_pid "dead" for the currently respawned process?

Highlighted
Frequent Advisor

Re: /etc/utmp not updated quick enough by inittab respawns

Dennis, you are correct, I am trying to pull out the utp->ut_id. Based on the ut_id, we put
additional parameters into the environment.

I did try a sleep(5) and it did solve the problem. The issue that creates is, I don't believe the process will ever be shut down for respawning too fast. I really dont want inittab firing this thing up every 5 seconds if there really is a problem....
Highlighted
Acclaimed Contributor

Re: /etc/utmp not updated quick enough by inittab respawns

Hi (again):

> I did try a sleep(5) and it did solve the problem.

Ah, "...Sleep that knits up the ravell'd sleeve of care..."

Regards :-)

...JRF...