Forking a new process without parent dependance


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Forking a new process without parent dependance
# 1  
Old 09-05-2008
Forking a new process without parent dependance

hi,

I want my program to fork a new process and then I want to kill the parent process. The parent program before dying will issue a SIGTERM to all its childs. Which eventually kills all Children.

I cant handle the SIGTERM at the child level.Smilie

What I was thinking of was the Parent process creates a Child process which is totally a new process and has nothing to do with the Parent process.

Any ideas ??
# 2  
Old 09-05-2008
This used to be a FAQ, but I can't quickly find the old "official" one which used to be posted to Usenet. Here's a nice summary I found in Google: Unix Daemon Server Programming

Actually here's the old one: http://www.faqs.org/faqs/unix-faq/programmer/faq/ but of course, it covers a whole lot of other topics too, so the condensed version above might be more suitable.
# 3  
Old 09-05-2008
Thankx Era, I wanted a second opinion, dont you think that a daemon would be an expensive proposition if I have to do a small thing like starting and restarting a service.

Is thier a light weight solution.




Quote:
Originally Posted by era
This used to be a FAQ, but I can't quickly find the old "official" one which used to be posted to Usenet. Here's a nice summary I found in Google: Unix Daemon Server Programming

Actually here's the old one: Unix Programming FAQ (v1.37) but of course, it covers a whole lot of other topics too, so the condensed version above might be more suitable.
# 4  
Old 09-05-2008
Thankx Era
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

forking a child process and kill its parent to show that child process has init() as its parent

Hi everyone i am very new to linux , working on bash shell. I am trying to solve the given problem 1. Create a process and then create children using fork 2. Check the Status of the application for successful running. 3. Kill all the process(threads) except parent and first child... (2 Replies)
Discussion started by: vizz_k
2 Replies

2. Programming

Parent forking

My question is, how do you fork only the parent processes in unix? For example how would I use the fork function to fork the parent process more than once and leave the children processes alone. This way I do not have children of children. The way I have it set up now it the parent process forks 3... (7 Replies)
Discussion started by: TWhitt24
7 Replies

3. Shell Programming and Scripting

[KSH/Bash] Starting a parent process from a child process?

Hey all, I need to launch a script from within 2 other scripts that can run independently of the two parent scripts... Im having a hard time doing this, if anyone knows how please let me know. More detail. ScriptA (bash), ScriptB (ksh), ScriptC (bash) ScriptA, launches ScriptB ScirptB,... (7 Replies)
Discussion started by: trey85stang
7 Replies

4. Shell Programming and Scripting

How to make the parent process to wait for the child process

Hi All, I have two ksh script. 1st script calls the 2nd script and the second script calls an 'C' program. I want 1st script to wait until the 'C' program completes. I cant able to get the process id for the 'C' program (child process) to make the 1st script to wait for the second... (7 Replies)
Discussion started by: sennidurai
7 Replies

5. Shell Programming and Scripting

Forking a bunch of processes and filling up the process table

I have a bash script that has been used for months here at work for doing an SSH into other machines both Linux and Solaris and running a script on the remote machine. Recently I have started to noticed that things are being left being on the maching doing the SSH. For example.... tivoli ... (1 Reply)
Discussion started by: LRoberts
1 Replies

6. UNIX for Dummies Questions & Answers

Testing the forking process.

Hey, first time poster and a new UNIX user here. My question is regarding the forking process. I logged in to tty1, and typed the command ls -1 and hit enter. How can i tell that the ls -1 command ran in a subshell? Thanks. (0 Replies)
Discussion started by: Vitamin254
0 Replies

7. UNIX for Advanced & Expert Users

VERY confused about forking of child process

hi, I thought that when a child shell is forked, it will inherit all the variables of the parent now in my .cshrc I have setenv X x then I do at command line setenv X y and X is now y. So far so good! I then have a very simple script, y.csh #!/usr/bin/csh echo X (7 Replies)
Discussion started by: JamesByars
7 Replies

8. Programming

forking process.

#include <stdio.h> #include <sys/types.h> #include <unistd.h> int main() { pid_t pID; int i; for (i = 0; i < 3; i++) { pID = fork (); if (pID == 0) { printf ("Value of i --> %d... (2 Replies)
Discussion started by: kymthasneem
2 Replies

9. Programming

forking a new process

Hi I'm currently working with C on UNIX (HPUX) and need to be able to fork a seperate Java process from within a running C process. I can run the following code from the command line via a script but am having difficulty getting it to work from within the code. I am trying to use execl. Is... (4 Replies)
Discussion started by: themezzaman
4 Replies

10. UNIX for Dummies Questions & Answers

forking and killing parent processes

Hi everybody, I'm having some problems wiriting a program in UNIX using the "fork" and "kill" system calls. I have to create a C program P0, which creates 9 other processes P1, P2, ..., P9, where P0 is the father of P1, P1 the father of P2, and so on. All the processes contain an infinite... (0 Replies)
Discussion started by: davewilliams20
0 Replies
Login or Register to Ask a Question