Code Comments
Programming Forum and web based access to our favorite programming groups.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.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.