Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

forking a shell process [ksh -c "command&"] - session leader
I have a server-program which forks a process to execute - ksh -c
"command&"
server forks a process to execute ksh
ksh forks child process to execute 'command'
But this child process receives SIGHUP before exec'ing command
and 'command' doesnt get executed at all.

This is probably happening because ksh is a session leader, and as ksh
dies after forking child process, system sends SIGHUP to all of its
session members.
**ksh -c "nohup command&" also doesnt work as child process recives
SIGHUP before exec;ing.**

I have written a simple daemon program [umask, setsid, no controlling
ttys] which forks a child process and execute the command.
And changed server-program to execute this daemon like - daemon ksh -c
"command&".
In above case , session leader is daemon, & not a ksh. Its working fine
for now.

I guess 'command' is not reciving SIGHUP because:- this daemon is not
associated with controlling terminals, so tty driver wont send SIGHUP
to any members on the death of session leader daemon.
Is it what happening over here? any other elegant solution?

I tried making servers' child process (which is going to fork to
execute ksh) daemon, but this doesnt work all the time. I observed that
when I 'strace' server-program , it works fine. Else it doesnt start
'command' at background.
why so?
What would be the elegant solution here.


Report this thread to moderator Post Follow-up to this message
Old Post
pankajtakawale
07-18-06 12:00 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Unix Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:27 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.