diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-12-06 20:27:39 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-12-06 20:27:39 +0000 |
commit | 5d5731d7736b9bbba10a3a98f3b7bc307e83473f (patch) | |
tree | abc3960c146e8a41e374eaa6b7573032c9d5b78d | |
parent | d3b9409b407e8260362e3971b24683562285460a (diff) |
This sleep accepts fractional timings as well.
Rephrase examples slightly.
-rw-r--r-- | bin/sleep/sleep.1 | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/bin/sleep/sleep.1 b/bin/sleep/sleep.1 index a592097c6be..332ecfce7c4 100644 --- a/bin/sleep/sleep.1 +++ b/bin/sleep/sleep.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sleep.1,v 1.8 1999/09/02 16:36:49 aaron Exp $ +.\" $OpenBSD: sleep.1,v 1.9 1999/12/06 20:27:38 espie Exp $ .\" $NetBSD: sleep.1,v 1.9 1995/07/25 19:37:43 jtc Exp $ .\" .\" Copyright (c) 1990, 1993, 1994 @@ -68,45 +68,54 @@ was received. .It Li \&>\&0 An error occurred. .El +.Pp +.Nm +handles fractional arguments as an extension to +.St -p1003.2 . .Sh EXAMPLES To schedule the execution of a command for .Va x -number seconds later: +seconds later: .Pp .Dl (sleep 1800; sh command_file >& errors)& .Pp This incantation would wait a half hour before -running the script command_file. (See the +running the script command_file (see also the .Xr at 1 -utility.) +utility). .Pp -To reiteratively run a command (with +To repetitively run a command (with .Xr csh 1 ) : .Pp .Bd -literal -offset indent -compact -while (1) - if (! -r zzz.rawdata) then - sleep 300 - else - foreach i (`ls *.rawdata`) - sleep 70 - awk -f collapse_data $i >> results - end - break - endif +while (! -r zzz.rawdata) + sleep 300 +end +foreach i (*.rawdata) + sleep 70 + awk -f collapse_data $i >> results end .Ed .Pp -The scenario for a script such as this might be: a program currently +The scenario for such a script might be: a program currently running is taking longer than expected to process a series of -files, and it would be nice to have -another program start processing the files created by the first -program as soon as it is finished (when zzz.rawdata is created). -The script checks every five minutes for the file zzz.rawdata, -when the file is found, then another portion processing -is done courteously by sleeping for 70 seconds in between each +files, and it would be nice to have another program start +processing the files created by the first program as soon as it is finished +(when zzz.rawdata is created). +The script checks every five minutes for the file zzz.rawdata. +Then, when the file is found, processing is done in several steps +by sleeping 70 seconds between each .Xr awk 1 job. +.Pp +To monitor the growth of a file without consuming too many resources : +.Pp +.Bd -literal -offset indent -compact +while true; do + ls -l file + sleep 5 +done +.Ed .Sh SEE ALSO .Xr at 1 , .Xr setitimer 2 , |