19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993, 1994 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 74b88c807SRodney W. Grimes.\" 84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 104b88c807SRodney W. Grimes.\" are met: 114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 124b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 144b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 154b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 16*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 174b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 184b88c807SRodney W. Grimes.\" without specific prior written permission. 194b88c807SRodney W. Grimes.\" 204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304b88c807SRodney W. Grimes.\" SUCH DAMAGE. 314b88c807SRodney W. Grimes.\" 324b88c807SRodney W. Grimes.\" @(#)sleep.1 8.3 (Berkeley) 4/18/94 332a456239SPeter Wemm.\" $FreeBSD$ 344b88c807SRodney W. Grimes.\" 354b88c807SRodney W. Grimes.Dd April 18, 1994 364b88c807SRodney W. Grimes.Dt SLEEP 1 374b88c807SRodney W. Grimes.Os 384b88c807SRodney W. Grimes.Sh NAME 394b88c807SRodney W. Grimes.Nm sleep 404b88c807SRodney W. Grimes.Nd suspend execution for an interval of time 414b88c807SRodney W. Grimes.Sh SYNOPSIS 42ac14c311SRuslan Ermilov.Nm 434b88c807SRodney W. Grimes.Ar seconds 444b88c807SRodney W. Grimes.Sh DESCRIPTION 454b88c807SRodney W. GrimesThe 469ba8bd65SPhilippe Charnier.Nm 474b88c807SRodney W. Grimescommand 484b88c807SRodney W. Grimessuspends execution for a minimum of 494b88c807SRodney W. Grimes.Ar seconds . 5064373ec6SRuslan Ermilov.Pp 5164373ec6SRuslan ErmilovIf the 5264373ec6SRuslan Ermilov.Nm 5364373ec6SRuslan Ermilovcommand receives a signal, it takes the standard action. 5467a54762SKonstantin BelousovWhen the 5567a54762SKonstantin Belousov.Dv SIGINFO 5667a54762SKonstantin Belousovsignal is received, the estimate of the amount of seconds left to 5767a54762SKonstantin Belousovsleep is printed on the standard output. 58ac14c311SRuslan Ermilov.Sh IMPLEMENTATION NOTES 5964373ec6SRuslan ErmilovThe 6064373ec6SRuslan Ermilov.Dv SIGALRM 6164373ec6SRuslan Ermilovsignal is not handled specially by this implementation. 62ac14c311SRuslan Ermilov.Pp 63ac14c311SRuslan ErmilovThe 64ac14c311SRuslan Ermilov.Nm 6567a54762SKonstantin Belousovcommand allows and honors a non-integer number of seconds to sleep 6667a54762SKonstantin Belousovin any form acceptable by 6767a54762SKonstantin Belousov.Xr strtod 3 . 68ac14c311SRuslan ErmilovThis is a non-portable extension, and its use will nearly guarantee that 69ac14c311SRuslan Ermilova shell script will not execute properly on another system. 706fca4c7cSRuslan Ermilov.Sh EXIT STATUS 716fca4c7cSRuslan Ermilov.Ex -std 724b88c807SRodney W. Grimes.Sh EXAMPLES 734b88c807SRodney W. GrimesTo schedule the execution of a command for 744b88c807SRodney W. Grimes.Va x 7543d088beSTim J. Robbinsnumber seconds later (with 7643d088beSTim J. Robbins.Xr csh 1 ) : 774b88c807SRodney W. Grimes.Pp 784b88c807SRodney W. Grimes.Dl (sleep 1800; sh command_file >& errors)& 794b88c807SRodney W. Grimes.Pp 804b88c807SRodney W. GrimesThis incantation would wait a half hour before 814e86fcacSSheldon Hearnrunning the script command_file. 824e86fcacSSheldon Hearn(See the 834b88c807SRodney W. Grimes.Xr at 1 844b88c807SRodney W. Grimesutility.) 854b88c807SRodney W. Grimes.Pp 864b88c807SRodney W. GrimesTo reiteratively run a command (with the 874b88c807SRodney W. Grimes.Xr csh 1 ) : 884b88c807SRodney W. Grimes.Pp 894b88c807SRodney W. Grimes.Bd -literal -offset indent -compact 904b88c807SRodney W. Grimeswhile (1) 914b88c807SRodney W. Grimes if (! -r zzz.rawdata) then 924b88c807SRodney W. Grimes sleep 300 934b88c807SRodney W. Grimes else 944b88c807SRodney W. Grimes foreach i (`ls *.rawdata`) 954b88c807SRodney W. Grimes sleep 70 964b88c807SRodney W. Grimes awk -f collapse_data $i >> results 974b88c807SRodney W. Grimes end 984b88c807SRodney W. Grimes break 994b88c807SRodney W. Grimes endif 1004b88c807SRodney W. Grimesend 1014b88c807SRodney W. Grimes.Ed 1024b88c807SRodney W. Grimes.Pp 1034b88c807SRodney W. GrimesThe scenario for a script such as this might be: a program currently 1044b88c807SRodney W. Grimesrunning is taking longer than expected to process a series of 1054b88c807SRodney W. Grimesfiles, and it would be nice to have 1064b88c807SRodney W. Grimesanother program start processing the files created by the first 1074b88c807SRodney W. Grimesprogram as soon as it is finished (when zzz.rawdata is created). 1084b88c807SRodney W. GrimesThe script checks every five minutes for the file zzz.rawdata, 1094b88c807SRodney W. Grimeswhen the file is found, then another portion processing 1104b88c807SRodney W. Grimesis done courteously by sleeping for 70 seconds in between each 1114b88c807SRodney W. Grimesawk job. 1124b88c807SRodney W. Grimes.Sh SEE ALSO 11322307be5SRuslan Ermilov.Xr nanosleep 2 , 11422307be5SRuslan Ermilov.Xr sleep 3 1154b88c807SRodney W. Grimes.Sh STANDARDS 1164b88c807SRodney W. GrimesThe 1179ba8bd65SPhilippe Charnier.Nm 1184b88c807SRodney W. Grimescommand is expected to be 1194b88c807SRodney W. Grimes.St -p1003.2 1204b88c807SRodney W. Grimescompatible. 12191c00818STim J. Robbins.Sh HISTORY 12291c00818STim J. RobbinsA 12391c00818STim J. Robbins.Nm 12491c00818STim J. Robbinscommand appeared in 12591c00818STim J. Robbins.At v4 . 126