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. 164b88c807SRodney W. Grimes.\" 4. 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. 54ac14c311SRuslan Ermilov.Sh IMPLEMENTATION NOTES 5564373ec6SRuslan ErmilovThe 5664373ec6SRuslan Ermilov.Dv SIGALRM 5764373ec6SRuslan Ermilovsignal is not handled specially by this implementation. 58ac14c311SRuslan Ermilov.Pp 59ac14c311SRuslan ErmilovThe 60ac14c311SRuslan Ermilov.Nm 61ac14c311SRuslan Ermilovcommand will accept and honor a non-integer number of specified seconds 62c4d9468eSRuslan Ermilov(with a 6312e720d7SRuslan Ermilov.Ql .\& 64c4d9468eSRuslan Ermilovcharacter as a decimal point). 65ac14c311SRuslan Ermilov.Bf Sy 66ac14c311SRuslan ErmilovThis is a non-portable extension, and its use will nearly guarantee that 67ac14c311SRuslan Ermilova shell script will not execute properly on another system. 68ac14c311SRuslan Ermilov.Ef 694b88c807SRodney W. Grimes.Sh EXAMPLES 704b88c807SRodney W. GrimesTo schedule the execution of a command for 714b88c807SRodney W. Grimes.Va x 7243d088beSTim J. Robbinsnumber seconds later (with 7343d088beSTim J. Robbins.Xr csh 1 ) : 744b88c807SRodney W. Grimes.Pp 754b88c807SRodney W. Grimes.Dl (sleep 1800; sh command_file >& errors)& 764b88c807SRodney W. Grimes.Pp 774b88c807SRodney W. GrimesThis incantation would wait a half hour before 784e86fcacSSheldon Hearnrunning the script command_file. 794e86fcacSSheldon Hearn(See the 804b88c807SRodney W. Grimes.Xr at 1 814b88c807SRodney W. Grimesutility.) 824b88c807SRodney W. Grimes.Pp 834b88c807SRodney W. GrimesTo reiteratively run a command (with the 844b88c807SRodney W. Grimes.Xr csh 1 ) : 854b88c807SRodney W. Grimes.Pp 864b88c807SRodney W. Grimes.Bd -literal -offset indent -compact 874b88c807SRodney W. Grimeswhile (1) 884b88c807SRodney W. Grimes if (! -r zzz.rawdata) then 894b88c807SRodney W. Grimes sleep 300 904b88c807SRodney W. Grimes else 914b88c807SRodney W. Grimes foreach i (`ls *.rawdata`) 924b88c807SRodney W. Grimes sleep 70 934b88c807SRodney W. Grimes awk -f collapse_data $i >> results 944b88c807SRodney W. Grimes end 954b88c807SRodney W. Grimes break 964b88c807SRodney W. Grimes endif 974b88c807SRodney W. Grimesend 984b88c807SRodney W. Grimes.Ed 994b88c807SRodney W. Grimes.Pp 1004b88c807SRodney W. GrimesThe scenario for a script such as this might be: a program currently 1014b88c807SRodney W. Grimesrunning is taking longer than expected to process a series of 1024b88c807SRodney W. Grimesfiles, and it would be nice to have 1034b88c807SRodney W. Grimesanother program start processing the files created by the first 1044b88c807SRodney W. Grimesprogram as soon as it is finished (when zzz.rawdata is created). 1054b88c807SRodney W. GrimesThe script checks every five minutes for the file zzz.rawdata, 1064b88c807SRodney W. Grimeswhen the file is found, then another portion processing 1074b88c807SRodney W. Grimesis done courteously by sleeping for 70 seconds in between each 1084b88c807SRodney W. Grimesawk job. 10943d088beSTim J. Robbins.Sh DIAGNOSTICS 11043d088beSTim J. Robbins.Ex -std 1114b88c807SRodney W. Grimes.Sh SEE ALSO 11222307be5SRuslan Ermilov.Xr nanosleep 2 , 11322307be5SRuslan Ermilov.Xr sleep 3 1144b88c807SRodney W. Grimes.Sh STANDARDS 1154b88c807SRodney W. GrimesThe 1169ba8bd65SPhilippe Charnier.Nm 1174b88c807SRodney W. Grimescommand is expected to be 1184b88c807SRodney W. Grimes.St -p1003.2 1194b88c807SRodney W. Grimescompatible. 12091c00818STim J. Robbins.Sh HISTORY 12191c00818STim J. RobbinsA 12291c00818STim J. Robbins.Nm 12391c00818STim J. Robbinscommand appeared in 12491c00818STim J. Robbins.At v4 . 125