Jump to content

Running a new Process

- - - - -

  • Please log in to reply
1 reply to this topic

#1
agnl666

agnl666

    Programmer

  • Members
  • PipPipPipPip
  • 173 posts
  • Programming Language:C, Java, C++
  • Learning:Python, Assembly
Hi Everyone and thanks in advance.

I am currently working on a little daemon that will spawn a process every so often. I want the daemon to execute an external c program and keep running without any concern given at this point to whether or not the child process has finished, or even been successful.

At the moment I have looked exec() though the process is taken over by the child process and therefor I cannot keep running to spawn more process. This has lead me to look for different methods.

1 ) Fork() a child process to run exec() (that way that child process may do whatever and I may continue on wards). I am wondering though, how would I go about forking a already child process?

2 ) I am not sure whether the spawn() method(s) will work though they sound to be what I may need. I have not been able to find documentation on the spawn methods though and so I have come here.

I would really appreciate a link to the spawn() documentation, or documentation of some kind. If someone could explain the possibility of forking an already child process that would also be cool. (If I was unclear at any point let me know)

Thanks : )

#2
agnl666

agnl666

    Programmer

  • Members
  • PipPipPipPip
  • 173 posts
  • Programming Language:C, Java, C++
  • Learning:Python, Assembly
Problem Solved. I can simply fork() the daemon (already fork()ed process) and then allow the child process to run exec(). This way I do not have to halt/override the process with the exec() process. If anyone wants me to explain this further let me know.

I am still interested in the spawn() reference though so if anyone has a link.

Thanks : )




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users