LinuxCommandLibrary

waitpid

Wait for arbitrary processes to terminate

TLDR

Wait for processes to exit

$ waitpid [pid1] [pid2]
copy
Wait with timeout
$ waitpid -t [n] [pid1] [pid2]
copy
Ignore already exited processes
$ waitpid -e [pid1] [pid2]
copy
Wait for N processes
$ waitpid -c [n] [pid1] [pid2]
copy
Display help
$ waitpid -h
copy

SYNOPSIS

waitpid [OPTIONS] PID...

DESCRIPTION

waitpid waits for the termination of arbitrary processes by their PIDs. Unlike the shell built-in wait, it can wait for any process, not just children of the current shell.
The command blocks until all specified processes have terminated or the timeout expires.

PARAMETERS

-t, --timeout SECONDS

Maximum time to wait
-e, --exited
Don't error if PIDs have already exited
-c, --count N
Wait until N processes have exited
-h, --help
Display help information

CAVEATS

Part of util-linux. Can only monitor processes visible to the current user. Requires appropriate permissions to monitor processes.

SEE ALSO

wait(1), kill(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community