Main index | Section 1 | Options |
The following option is available:
| |
Exit when any of the given processes has terminated. | |
| |
If any process is still running after
duration,
pwait
will exit.
The
duration
value can be integer or decimal numbers.
Values without unit symbols are interpreted as seconds.
Supported unit symbols are: | |
s | seconds |
m | minutes |
h | hours |
| |
Print the exit status when each process terminates or ‘timeout’ if the timer goes off earlier. | |
If the
Invalid pids elicit a warning message but are otherwise ignored.
$ sleep 30 & sleep 3600 & [1] 1646 [2] 1647 $ pwait -o -t5 1646 1647 $? 124
Same as above but try to obtain the exit status of the processes. In this case ‘timeout’ is shown and the exit status is 124:
$ sleep 30 & sleep 3600 & [1] 1652 [2] 1653 $ pwait -v -t 5 1652 1653 timeout $? 124
Start two sleep(1) processes in the background sleeping for 30 and 40 seconds respectively. Wait 60 seconds for any of them to finish and get their exit codes:
$ sleep 30 & sleep 40 & [1] 1674 [2] 1675 $ pwait -v -t 60 1674 1675 1674: exited with status 0. 1675: exited with status 0. [1]- Done sleep 30 [2]+ Done sleep 40 $ echo $? 0
To avoid deadlock, pwait will ignore its own pid, if it is provided as a process id to wait for.
PWAIT (1) | January 21, 2021 |
Main index | Section 1 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | The “N” in NFS stands for Not, or Need, or perhaps Nightmare | ” |
— Harry Spencer |