sleep(1): minor markup tweaks

This commit is contained in:
uwe 2023-02-19 10:54:35 +00:00
parent 2821a47d1c
commit a525a2707f
1 changed files with 36 additions and 19 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sleep.1,v 1.27 2019/01/27 17:42:53 wiz Exp $ .\" $NetBSD: sleep.1,v 1.28 2023/02/19 10:54:35 uwe Exp $
.\" .\"
.\" Copyright (c) 1990, 1993, 1994 .\" Copyright (c) 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -47,19 +47,24 @@ The
utility suspends execution for a minimum of utility suspends execution for a minimum of
.Ar seconds .Ar seconds
seconds, then exits. seconds, then exits.
It is usually used to schedule the execution of other commands (see It is usually used to schedule the execution of other commands
.Po
see
.Sx EXAMPLES .Sx EXAMPLES
below). below
.Pc .
.Pp .Pp
Note: The .Em Note :
The
.Nx .Nx
.Nm .Nm
command will accept and honor a non-integer number of specified seconds. command will accept and honor a non-integer number of specified seconds.
Note however, that if the request is for much more than 2.5 hours, Note however, that if the request is for much more than 2.5 hours,
any fractional seconds will be ignored. any fractional seconds will be ignored.
Permitting non-integral delays is a non-portable extension, Permitting non-integral delays is a
and its use will decrease the probability that .Em non-portable
a shell script will execute properly on another system. extension, and its use will decrease the probability that a shell
script will execute properly on another system.
.Pp .Pp
When the When the
.Dv SIGINFO .Dv SIGINFO
@ -74,7 +79,7 @@ utility exits with one of the following values:
On successful completion, or if the signal On successful completion, or if the signal
.Dv SIGALRM .Dv SIGALRM
was received. was received.
.It Li \&>\&0 .It Li \&>0
An error occurred. An error occurred.
.El .El
.Sh EXAMPLES .Sh EXAMPLES
@ -84,10 +89,12 @@ To schedule the execution of a command for 1800 seconds later:
.Pp .Pp
This incantation would wait half an hour before This incantation would wait half an hour before
running the script running the script
.Dq command_file . .Ar command_file .
(See the .Po
See the
.Xr at 1 .Xr at 1
utility.) utility
.Pc .
.Pp .Pp
To repeatedly run a command (using To repeatedly run a command (using
.Xr csh 1 ) : .Xr csh 1 ) :
@ -110,17 +117,27 @@ The scenario for a script such as this might be: a program currently
running is taking longer than expected to process a series of running is taking longer than expected to process a series of
files, and it would be nice to have files, and it would be nice to have
another program start processing the files created by the first another program start processing the files created by the first
program as soon as it is finished (when zzz.rawdata is created). program as soon as it is finished
The script checks every five minutes for the file zzz.rawdata. .Po
When the file is found, processing the generated files (*.rawdata) when
.Li zzz.rawdata
is created
.Pc .
The script checks every five minutes for the file
.Li zzz.rawdata .
When the file is found, processing the generated files
.Pq Li *.rawdata
is done courteously by sleeping for 70 seconds in between each is done courteously by sleeping for 70 seconds in between each
awk job. awk job.
.Pp .Pp
To wait until a particular time, the following, To wait until a particular time, the following,
with some error checking added, might be used (using with some error checking added, might be used
.Po
using
.Xr sh 1 .Xr sh 1
on on
.Nx ) : .Nx
.Pc :
.Bd -literal -offset indent .Bd -literal -offset indent
END=$(( $( date -d "$1" +%s ) - START_TIME )) END=$(( $( date -d "$1" +%s ) - START_TIME ))
while [ "${SECONDS}" -lt "${END}" ] while [ "${SECONDS}" -lt "${END}" ]
@ -130,7 +147,7 @@ done
.Ed .Ed
.Pp .Pp
where the argument where the argument
.Sq \&$1 .Ql $1
specifies the desired date and time in any format the specifies the desired date and time in any format the
.Fl d .Fl d
option to the option to the
@ -155,11 +172,11 @@ A
utility appeared in utility appeared in
.At v4 . .At v4 .
Processing fractional seconds, and processing the Processing fractional seconds, and processing the
.Ic seconds .Ar seconds
argument respecting the current locale, was added in argument respecting the current locale, was added in
.Nx 1.3 . .Nx 1.3 .
The ability to sleep for extended periods appeared in The ability to sleep for extended periods appeared in
.Nx 9 . .Nx 9.0 .
.Sh BUGS .Sh BUGS
This This
.Nm .Nm