xref: /freebsd/bin/sleep/sleep.1 (revision 46be34b90213ebd9037cb2c24aec0009d7f2f5c1)
14b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993, 1994
24b88c807SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
34b88c807SRodney W. Grimes.\"
44b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by
54b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc.
64b88c807SRodney W. Grimes.\"
74b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
84b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions
94b88c807SRodney W. Grimes.\" are met:
104b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
114b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
124b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
134b88c807SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
144b88c807SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
154b88c807SRodney W. Grimes.\" 3. All advertising materials mentioning features or use of this software
164b88c807SRodney W. Grimes.\"    must display the following acknowledgement:
174b88c807SRodney W. Grimes.\"	This product includes software developed by the University of
184b88c807SRodney W. Grimes.\"	California, Berkeley and its contributors.
194b88c807SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
204b88c807SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
214b88c807SRodney W. Grimes.\"    without specific prior written permission.
224b88c807SRodney W. Grimes.\"
234b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
244b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
254b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
264b88c807SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
274b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
284b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
294b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
304b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
314b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
324b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
334b88c807SRodney W. Grimes.\" SUCH DAMAGE.
344b88c807SRodney W. Grimes.\"
354b88c807SRodney W. Grimes.\"	@(#)sleep.1	8.3 (Berkeley) 4/18/94
3646be34b9SKris Kennaway.\"	$Id: sleep.1,v 1.8 1998/05/18 06:46:11 charnier Exp $
374b88c807SRodney W. Grimes.\"
384b88c807SRodney W. Grimes.Dd April 18, 1994
394b88c807SRodney W. Grimes.Dt SLEEP 1
404b88c807SRodney W. Grimes.Os
414b88c807SRodney W. Grimes.Sh NAME
424b88c807SRodney W. Grimes.Nm sleep
434b88c807SRodney W. Grimes.Nd suspend execution for an interval of time
444b88c807SRodney W. Grimes.Sh SYNOPSIS
454b88c807SRodney W. Grimes.Nm sleep
464b88c807SRodney W. Grimes.Ar seconds
474b88c807SRodney W. Grimes.Sh DESCRIPTION
484b88c807SRodney W. GrimesThe
499ba8bd65SPhilippe Charnier.Nm
504b88c807SRodney W. Grimescommand
514b88c807SRodney W. Grimessuspends execution for a minimum of
524b88c807SRodney W. Grimes.Ar seconds .
539ba8bd65SPhilippe Charnier.Nm Sleep
544b88c807SRodney W. Grimesis used to schedule the execution of other commands (see
554b88c807SRodney W. Grimes.Sx EXAMPLES
564b88c807SRodney W. Grimesbelow).
574b88c807SRodney W. Grimes.Pp
58a2640290SAndrey A. ChernovIf the
599ba8bd65SPhilippe Charnier.Nm
60a2640290SAndrey A. Chernovcommand
61a2640290SAndrey A. Chernovreceives a SIGALRM signal, it terminates normally with a zero exit status,
62a2640290SAndrey A. Chernovfor any other signal it takes the standard action.
6346be34b9SKris Kennaway.Sh DIAGNOSTICS
644b88c807SRodney W. GrimesThe
65db5b8cafSSteve Price.Nm
664b88c807SRodney W. Grimesutility exits with one of the following values:
674b88c807SRodney W. Grimes.Bl -tag -width flag
684b88c807SRodney W. Grimes.It Li \&0
694b88c807SRodney W. GrimesOn successful completion, or if the signal
704b88c807SRodney W. Grimes.Dv SIGALRM
714b88c807SRodney W. Grimeswas received.
724b88c807SRodney W. Grimes.It Li \&>\&0
734b88c807SRodney W. GrimesAn error occurred.
744b88c807SRodney W. Grimes.El
754b88c807SRodney W. Grimes.Sh EXAMPLES
764b88c807SRodney W. GrimesTo schedule the execution of a command for
774b88c807SRodney W. Grimes.Va x
784b88c807SRodney W. Grimesnumber seconds later:
794b88c807SRodney W. Grimes.Pp
804b88c807SRodney W. Grimes.Dl (sleep 1800; sh command_file >& errors)&
814b88c807SRodney W. Grimes.Pp
824b88c807SRodney W. GrimesThis incantation would wait a half hour before
834b88c807SRodney W. Grimesrunning the script command_file. (See the
844b88c807SRodney W. Grimes.Xr at 1
854b88c807SRodney W. Grimesutility.)
864b88c807SRodney W. Grimes.Pp
874b88c807SRodney W. GrimesTo reiteratively run a command (with the
884b88c807SRodney W. Grimes.Xr csh 1 ) :
894b88c807SRodney W. Grimes.Pp
904b88c807SRodney W. Grimes.Bd -literal -offset indent -compact
914b88c807SRodney W. Grimeswhile (1)
924b88c807SRodney W. Grimes	if (! -r zzz.rawdata) then
934b88c807SRodney W. Grimes		sleep 300
944b88c807SRodney W. Grimes	else
954b88c807SRodney W. Grimes		foreach i (`ls *.rawdata`)
964b88c807SRodney W. Grimes			sleep 70
974b88c807SRodney W. Grimes			awk -f collapse_data $i >> results
984b88c807SRodney W. Grimes		end
994b88c807SRodney W. Grimes		break
1004b88c807SRodney W. Grimes	endif
1014b88c807SRodney W. Grimesend
1024b88c807SRodney W. Grimes.Ed
1034b88c807SRodney W. Grimes.Pp
1044b88c807SRodney W. GrimesThe scenario for a script such as this might be: a program currently
1054b88c807SRodney W. Grimesrunning is taking longer than expected to process a series of
1064b88c807SRodney W. Grimesfiles, and it would be nice to have
1074b88c807SRodney W. Grimesanother program start processing the files created by the first
1084b88c807SRodney W. Grimesprogram as soon as it is finished (when zzz.rawdata is created).
1094b88c807SRodney W. GrimesThe script checks every five minutes for the file zzz.rawdata,
1104b88c807SRodney W. Grimeswhen the file is found, then another portion processing
1114b88c807SRodney W. Grimesis done courteously by sleeping for 70 seconds in between each
1124b88c807SRodney W. Grimesawk job.
1134b88c807SRodney W. Grimes.Sh SEE ALSO
114af202156SWolfram Schneider.Xr at 1 ,
1154b88c807SRodney W. Grimes.Xr setitimer 2 ,
1164b88c807SRodney W. Grimes.Xr alarm 3 ,
117af202156SWolfram Schneider.Xr sleep 3
1184b88c807SRodney W. Grimes.Sh STANDARDS
1194b88c807SRodney W. GrimesThe
1209ba8bd65SPhilippe Charnier.Nm
1214b88c807SRodney W. Grimescommand is expected to be
1224b88c807SRodney W. Grimes.St -p1003.2
1234b88c807SRodney W. Grimescompatible.
124