Re: catch exit status of daemon

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



wait and waitpid would not work because a Process A would wait for process B(which is a parent of the daemon), process B immediately exits and process A would be notified.
In my case, I want to query the status of process C(which is child of process B) / grandchild of process A which is a child of init after process B terminates, 

                  fork                            fork
process A -------------> Process B --------------> Process C

Process A should query the status of process C

Once process C is daemon, Process C would be the the child of init.

Can we do something by making a process A to be a daemon (child of init), because process A and process C are sibling, can siblings query the status of each other.

IPC is not an option for me, because there are several service and process A do not know how and what is the process C, it should just monitor so many child process.

Regards,
Yash.

On Wed, Jan 7, 2015 at 1:35 PM, Sudip Mukherjee <sudipm.mukherjee@xxxxxxxxx> wrote:
On Wed, Jan 7, 2015 at 12:57 AM, Nizam Haider <nizamhaider786@xxxxxxxxx> wrote:
> Anuz Pratap Singh Tomar <chambilkethakur <at> gmail.com> writes:
>
>>
>>
>>
>> On Tue, Jan 6, 2015 at 3:22 PM, Yash Jain <yash2learn <at> gmail.com>
> wrote:Hello All,I have one dumb question,
>> I wanted to write a process which monitors the exit status of the daemon,
>>
>> The Main process would fork a service, which would internally fork a child
> and , exit from the process. If main process wants to query the status of
> the daemon, how it can be achived.
>>
>> For ex :
>> Process A would call a syslog service, which would internally fork a
> child, daemon it and exit, so if process A wants to wait for the syslog
> process, is it possible.
>>
>>
>> waitpid()
>>
>> signal()
> WIFEXITED
> WEXITSTATUS

doubt --
wait and waitpid will be for the parent process to wait for its child.
but for a daemon the parent is init .
so the exit status should be sent to init and not to his process. then
how does he get the exit status

sudip

>>

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux