ksh children won't die ; exec doesn't work properly; ksh -p

ksh children won't die ; exec doesn't work properly; ksh -p

Post by Tony J Yeat » Sat, 24 Apr 1993 04:28:05

I'm having problems with Korn shell's exec ...I have converted
some old csh scripts to ksh, which seems to have worked fine,
except for two problems:-

(1) When I kill the parent process - the child processes do not
all die!!! (This one is driving me up the wall).  

Complication: I need to keep one child alive (I use nohup ... & for this)
As the children did not die with their parent, I tried to
kill them in the parent's interupt routine with kill -hup 0
- unfortunately this results in an infinite loop into the
interupt routine ...of course!

(2) When I exec another ksh script, instead of overwriting
the current process - a child process is spawned....why
for heaven sake???

One more question.  What exactly does ksh -p do for me (I thought
it just prevent the ksh reading my .profile, and so would
be good to place on the first line of my scripts, however according
to "Unix Desktop Guide to the Korn Shell" ( a better book than
Korn book for most things IMHO) it described this option as
"Set protected mode" but fails to elaborate further.

I'd be grateful for any help or suggestions.  (E-mail response
would be preferred, but I'll try to check back here.)

"As the leader in the cellular industry and a company that places top priority
on the interests and concerns of our customers and the public, we intend to
address these concerns in a straightforward, responsible manner.
..First, let me assure you that all of our products are safe."- Pres. Motorola GSS


1. > ksh children won't die ; exec doesn't work properly (solution)

I traced my exec problem to the tee command:-

        exec next_script | tee log

replacing this with:-

        exec next_script | tee -i log

did the trick.

I'm not really sure why the child processes did not die with
the parent though (I guess tee got killed too soon for ksh's
liking).  If anybody can explain how/why this occured, I'd be
interested to hear - I've tried to explain it away, but I can't
to my satisfaction  (BTW I'm guessing that this problem is what
tee's -i option was created for).

"My mule don't like you laughin'"

2. Two Segment setup

3. nohup (script1.ksh ; script2.ksh ) & doesn't work

4. Automatic Partitioning wiped my c drive

5. KSH .profile problem - Why doesn't this work and how to make it work?

6. CDE Timezone

7. KSH Process doesn't die

8. Problem with inn

9. PPP doesn't die, it just doesn't work anymore

10. Old ksh doesn't have '!=="not"' -- What to do?

11. pd-ksh/zsh won't inherit '747=jet' env var?

12. 'less' command doesn't work properly in searching strings...

13. 'su -c' doesn't work properly?