pwait.1 (fa9896e082a1046ff4fbc75fcba4d18d1f2efc19) | pwait.1 (1a7c9e1585dd3ae14b03226e359d434c10066bfb) |
---|---|
1.\" 2.\" Copyright (c) 2004-2009, Jilles Tjoelker 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with 6.\" or without modification, are permitted provided that the 7.\" following conditions are met: 8.\" --- 83 unchanged lines hidden (view full) --- 92The first one will sleep for 30 seconds and the second one for one hour. 93Wait for any of them to finish but no more than 5 seconds. 94Since a timeout occurs the exit status is 124: 95.Bd -literal -offset indent 96$ sleep 30 & sleep 3600 & 97[1] 1646 98[2] 1647 99$ pwait -o -t5 1646 1647 | 1.\" 2.\" Copyright (c) 2004-2009, Jilles Tjoelker 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with 6.\" or without modification, are permitted provided that the 7.\" following conditions are met: 8.\" --- 83 unchanged lines hidden (view full) --- 92The first one will sleep for 30 seconds and the second one for one hour. 93Wait for any of them to finish but no more than 5 seconds. 94Since a timeout occurs the exit status is 124: 95.Bd -literal -offset indent 96$ sleep 30 & sleep 3600 & 97[1] 1646 98[2] 1647 99$ pwait -o -t5 1646 1647 |
100$? | 100$ echo $? |
101124 102.Ed 103.Pp 104Same as above but try to obtain the exit status of the processes. 105In this case 106.Ql timeout 107is shown and the exit status is 124: 108.Bd -literal -offset indent 109$ sleep 30 & sleep 3600 & 110[1] 1652 111[2] 1653 112$ pwait -v -t 5 1652 1653 113timeout | 101124 102.Ed 103.Pp 104Same as above but try to obtain the exit status of the processes. 105In this case 106.Ql timeout 107is shown and the exit status is 124: 108.Bd -literal -offset indent 109$ sleep 30 & sleep 3600 & 110[1] 1652 111[2] 1653 112$ pwait -v -t 5 1652 1653 113timeout |
114$? | 114$ echo $? |
115124 116.Ed 117.Pp 118Start two 119.Xr sleep 1 120processes in the background sleeping for 30 and 40 seconds respectively. 121Wait 60 seconds for any of them to finish and get their exit codes: 122.Bd -literal -offset indent --- 31 unchanged lines hidden --- | 115124 116.Ed 117.Pp 118Start two 119.Xr sleep 1 120processes in the background sleeping for 30 and 40 seconds respectively. 121Wait 60 seconds for any of them to finish and get their exit codes: 122.Bd -literal -offset indent --- 31 unchanged lines hidden --- |