Thank you for you quick reply, your advice worked.
I understand what you mean about the children of the children (i.e. the sleep processes) not getting the signal. I tried the following:
Changed "child1" to:
and then "child2" to:
so that the INT signals gets propagated to the spawned "sleep" children of each. When I now send a SIGINT to the original parent script, I see that the sleep processes are killed active. I think this solves the problem.
I don't follow what these are...
this is what my text says...
"When a process is started, a duplicate of that process is created. This new process is called the child and the process that created it is called the parent. The child process then replaces the copy for the code the parent... (1 Reply)
:(
Since I'm fairly new to the scene and don't have much experience in shell programming, I decided to check out the net for a useful script or two.
What I'm looking for is a script that would let me enter a PID and then show the process tree associated with it.
So it would display the (grand-)... (2 Replies)
Hello all,
I have gone through the search and looked at posting about idle users and killing processes. Here is my question I would like to kill an idle user ( which I can do) but how can I asure that all of his process is also killed whit out tracing his inital start PID. I have tried this on a... (4 Replies)
Hello.
I have a global function name func1() that I am sourcing in from script A. I call the function from script B. Is there a way to find out which script called func1() dynamically so that the func1() can report it in the event there are errors?
Thanks (2 Replies)
Greets all. I'm using Slackware 12.0 with the bash shell. Calling my scripts with /bin/sh...
I'm building gnome-2.18.3 and I have all my build scripts ready and working but I'm calling them from a parent script which executes each child/build script in a certain order (for loop).
I have "set... (6 Replies)
Hi
I have a shell script A which calls another 10 shell scripts which run in background. How do i make the parent script wait for the child scripts complete, or in other words, i must be able to do a grep of parent script to find out if the child scripts are still running.
My Code:
... (5 Replies)
Hi all,
I am writing a script which calls other third party scripts that perform numerous actions. I have no control over these scripts.
My problem is, one of these scripts seems to execute and do what it is meant to do, but my calling / parent script always exits at that point. I need to... (4 Replies)
1. The problem statement, all variables and given/known data:
I need to make an program that in a loop creates one parent and five children with fork(). The problem i'm trying to solve is how to delete the parent and child of the childīs process.
2. Relevant commands, code, scripts,... (0 Replies)
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)
does anyone know how to check in an 'if' statement if a particular directory is a child directory of a particular directory?
help ~ (2 Replies)
Discussion started by: ymc1g11
2 Replies
LEARN ABOUT HPUX
system
system(3S)system(3S)NAME
system() - issue a shell command
SYNOPSIS DESCRIPTION
executes the command specified by the string pointed to by command. The environment of the executed command is as if a child process were
created using (see fork(2)), and the child process invoked the sh-posix(1) utility via a call to (see exec(2)) as follows:
ignores the and signals, and blocks the signal, while waiting for the command to terminate. If this might cause the application to miss a
signal that would have killed it, the application should examine the return value from and take whatever action is appropriate to the
application if the command terminated due to receipt of a signal.
does not affect the termination status of any child of the calling processes other than the process or processes it itself creates.
does not return until the child process has terminated.
APPLICATION USAGE
If the return value of is not -1, its value can be decoded through the use of the macros described in For convenience, these macros are
also provided in
Note that, while must ignore and and block while waiting for the child to terminate, the handling of signals in the executed command is as
specified by fork(2) and exec(2). For example, if is being caught or is set to when is called, the child is started with handling set to
Ignoring and in the parent process prevents coordination problems (such as two processes reading from the same terminal) when the executed
command ignores or catches one of the signals.
RETURN VALUE
If command is null, returns non-zero.
If command is not null, returns the termination status of the command language interpreter in the format specified by wait(2). The termi-
nation status of the command language interpreter is as specified for sh-posix(1), except that if some error prevents the command language
interpreter from executing after the child process is created, the return value from is as if the command language interpreter had termi-
nated using If a child process cannot be created, or if the termination status for the command language interpreter cannot be obtained,
returns -1 and sets to indicate the error.
DIAGNOSTICS
forks to create a child process which, in turn, in order to execute string. If the fork fails, returns -1 and sets If the exec fails,
returns the status value returned by (see wait(2)) for a process that terminates with a call of
ERRORS
If errors are encountered, sets values as described by fork(2).
FILES SEE ALSO sh(1), fork(2), exec(2), wait(2), thread_safety(5).
STANDARDS CONFORMANCE system(3S)