waitpid supports the WNOHANG option to check a child process is complete without blocking.
Typically you would check for child processes just before printing the shell prompt and report them exiting there. This means the process could be finished for quite a while but user is only notified with then hit return.
This simple example spawns 1 child process, checks it is still running before each prompt is printed and when it is complete prints the exist status.
. I wrote shell script with help to extract data and generate report . I need help to modify that in sub section .
Currently I am generating the report in this format
Version Name Host Total Number of Fails
10 Animator 45
10 Krachel ... (0 Replies)
Hi Guys,
I need to write a shell script, to which I have getting results from CPU and Memory Utilization. This is to generate automatically through Shell script by running cron job. Is it possible to write it. I am new to this shell scripting.
Can you please help me on this ASAP.
... (6 Replies)
I'm trying to read a bunch of log files and output the lines that contain particular strings.
To accomplish this, I've been running the following from the command line:
find . -name "*" | xargs grep " " | grep " " > output.txt
Two grep statements are needed in case I'm looking for a... (3 Replies)
Hi,
We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Hi ,
i need to write a script
like this
In 1.sh
./test.sh
wait(5sec)
send ctrl+C to server
./testxxxx.sh
first i need invoke test.sh from 1.sh , after wating for some time i need to close the test.sh script & i need to start new script
i tried to invoke script... (2 Replies)
Hi, I need some help to write a script
i need to write script that will count the no of logs generated for the day and specify the logfiles names which is not generated for the day.
Default no of log generate per day is 29
if less than 29 logs generated it should specify the perticular logfile... (7 Replies)
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Dear Unix gurus,
We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Please help me to write the shell script
AC|NAME|STATE|MAXVALUE|MINVALUE---------heading
111|UMA|ODISHA|123,00.00|54.00
111|UMA|ODISHA|124,00.00|25.00
111|UMA|ODISHA|114,00.00|58.00
111|UMA|ODISHA|104,00.00|00.00
111|UMA|ODISHA|194,00.00|19.00
111|UMA|ODISHA|184,00.00|64.00... (5 Replies)
Discussion started by: alokjyotibal
5 Replies
LEARN ABOUT MINIX
wait.h
wait.h(3HEAD) Headers wait.h(3HEAD)NAME
wait.h, wait - wait status
SYNOPSIS
#include <sys/wait.h>
DESCRIPTION
When a process waits for status from its children using either the wait(3C) or waitpid(3C) function, the status returned can be evaluated
with the following macros, defined in <sys/wait.h>. These macros evaluate to integral expressions. The stat argument to these macros is the
integer value returned from wait() or waitpid().
WCOREDUMP(stat) If the value of WIFSIGNALED (stat) is non-zero, this macro evaluates to a non-zero value if a core image of
the terminated child was created.
WEXITSTATUS(stat) If the value of WIFEXITED(stat) is non-zero, this macro evaluates to the exit code that the child process
passed to _exit() (see exit(2)) or exit(3C), or the value that the child process returned from main.
WIFCONTINUED(stat) Evaluates to a non-zero value if status was returned for a child process that has continued.
WIFEXITED(stat) Evaluates to a non-zero value if status was returned for a child process that terminated normally.
WIFSIGNALED(stat) Evaluates to a non-zero value if status was returned for a child process that terminated due to the receipt
of a signal.
WIFSTOPPED(stat) Evaluates to a non-zero value if status was returned for a child process that is currently stopped.
WSTOPSIG(stat) If the value of WIFSTOPPED(stat) is non-zero, this macro evaluates to the number of the signal that caused
the child process to stop.
WTERMSIG(stat) If the value of WIFSIGNALED(stat) is non-zero, this macro evaluates to the number of the signal that
caused the termination of the child process.
The <sys/wait.h> header defines the symbolic constants listed below for use with waitpid(3C).
WNOHANG Do not hang if no status is available; return immediately.
WUNTRACED Report status of stopped child process.
The symbolic constants listed below are defined as possible values for the options argument to waitid(2).
WEXITED Wait for processes that have exited.
WSTOPPED Status is returned for any child that has stopped upon receipt of a signal.
WCONTINUED Status is returned for any child that was stopped and has been continued.
WNOHANG Return immediately if there are no children to wait for.
WNOWAIT Keep the process whose status is returned in infop in a waitable state.
The type idtype_t is defined as an enumeration type whose possible values include the following:
P_ALL
P_PID
P_PGID
The id_t and pid_t types are defined as described in <sys/types.h>.
The siginfo_t type is defined as described in <signal.h>.
The rusage structure is defined as described in <sys/resource.h>.
Inclusion of the <sys/wait.h> header can also make visible all symbols from <signal.h> and <sys/resource.h>.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO exit(2), waitid(2), exit(3C), wait(3C), waitpid(3C),attributes(5), standards(5)SunOS 5.10 10 Sep 2004 wait.h(3HEAD)