MirBSD manpage: sleep(1)

SLEEP(1)                     BSD Reference Manual                     SLEEP(1)

NAME

     sleep - suspend execution for an interval of time

SYNOPSIS

     sleep time [...]

DESCRIPTION

     The sleep utility suspends execution for the amount of time specified by
     its operands.

     sleep is commonly used to delay proceeding within a series of commands.
     Another use is to schedule the execution of other commands, but sleep
     will not take changes to the system clock that occur during its execution
     into account (it sleeps "for time seconds", not "until a specific time");
     it also uses the simplified notion of a day having 86400 seconds.

     Each time operand (multiple operands are added together to form a total
     amount of time to sleep) must be comprised of a positive number, which
     may contain a decimal fraction, and optionally a suffix letter denoting a
     scaling factor. The scaling factors supported are as follows:

       s  seconds (1); default

       m  minutes (60)

       h  hours (3600)

       d  days (86400)

EXAMPLES

     Monitor the growth of a file without consuming too many resources:

           while sleep 5; do
                   ls -l file
           done

     Wait an half hour before running the script command_file (see also the
     at(1) utility):

           (sleep 1800; sh command_file >errors 2>&1) &

DIAGNOSTICS

     The sleep utility exits 0 on success or upon receipt of SIGALRM, and >0
     if an error occurs.

SEE ALSO

     at(1), select(2)

STANDARDS

     The sleep utility conforms to IEEE Std 1003.1-2008 ("POSIX.1").

     The handling of fractional arguments is provided as an extension to the
     specification. The handling of multiple arguments and an optional suffix
     is provided for compatibility with GNU coreutils' sleep utility.

AUTHORS

     mirabilos <m@mirbsd.org>

CAVEATS

     sleep parses fractional arguments up to six digits after the period; any
     further digits are silently ignored. Suffix scaling is performed after-
     wards and so can deviate up to 86.4 ms.

     The underlying system call accepts input to the microsecond but may be
     using a clock with coarse granularity, which affects the accuracy of the
     time actually slept; the time utility is known to use a much less accu-
     rate timer, but compiling the sleep utility with -DDEBUG will show that
     it always sleeps for at least the requested time.

MirBSD                         January 23, 2021                              1

Generated on 2021-01-25 02:04:05 by $MirOS: src/scripts/roff2htm,v 1.103 2021/01/23 20:24:35 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2021 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.