From owner-svn-src-all@freebsd.org Mon Oct 5 13:35:34 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB887424CE9; Mon, 5 Oct 2020 13:35:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C4hS644CXz3dZ5; Mon, 5 Oct 2020 13:35:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EF5616791; Mon, 5 Oct 2020 13:35:34 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 095DZYLv020446; Mon, 5 Oct 2020 13:35:34 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 095DZYhO020445; Mon, 5 Oct 2020 13:35:34 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010051335.095DZYhO020445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Mon, 5 Oct 2020 13:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366444 - head/bin/pwait X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/bin/pwait X-SVN-Commit-Revision: 366444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 13:35:34 -0000 Author: fernape (ports committer) Date: Mon Oct 5 13:35:34 2020 New Revision: 366444 URL: https://svnweb.freebsd.org/changeset/base/366444 Log: pwait(1): Add EXAMPLES section to man page * Add small EXAMPLES section to the man page showing the different flags and exit codes. * Complete description for -v flag. Approved by: manpages (bcr@) Modified: head/bin/pwait/pwait.1 Modified: head/bin/pwait/pwait.1 ============================================================================== --- head/bin/pwait/pwait.1 Mon Oct 5 09:03:17 2020 (r366443) +++ head/bin/pwait/pwait.1 Mon Oct 5 13:35:34 2020 (r366444) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 26, 2020 +.Dd October 5, 2020 .Dt PWAIT 1 .Os .Sh NAME @@ -73,7 +73,9 @@ minutes hours .El .It Fl v -Print the exit status when each process terminates. +Print the exit status when each process terminates or +.Ql timeout +if the timer goes off earlier. .El .Sh EXIT STATUS The @@ -85,6 +87,52 @@ If the flag is specified and a timeout occurs, the exit status will be 124. .Pp Invalid pids elicit a warning message but are otherwise ignored. +.Sh EXAMPLES +Start two +.Xr sleep 1 +processes in the background. +The first one will sleep for 30 seconds and the second one for one hour. +Wait for any of them to finish but no more than 5 seconds. +Since a timeout occurs the exit status is 124: +.Bd -literal -offset indent +$ sleep 30 & sleep 3600 & +[1] 1646 +[2] 1647 +$ pwait -o -t5 1646 1647 +$? +124 +.Ed +.Pp +Same as above but try to obtain the exit status of the processes. +In this case +.Ql timeout +is shown and the exit status is 124: +.Bd -literal -offset indent +$ sleep 30 & sleep 3600 & +[1] 1652 +[2] 1653 +$ pwait -v -t 5 1652 1653 +timeout +$? +124 +.Ed +.Pp +Start two +.Xr 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: +.Bd -literal -offset indent +$ 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 +.Ed .Sh SEE ALSO .Xr kill 1 , .Xr pkill 1 ,