xref: /csrg-svn/bin/sleep/sleep.1 (revision 50206)
144957Scael.\" Copyright (c) 1990 The Regents of the University of California.
244957Scael.\" All rights reserved.
319469Smckusick.\"
4*50206Sbostic.\" This code is derived from software contributed to Berkeley by
5*50206Sbostic.\" the Institute of Electrical and Electronics Engineers, Inc.
6*50206Sbostic.\"
744957Scael.\" %sccs.include.redist.man%
843736Scael.\"
9*50206Sbostic.\"     @(#)sleep.1	6.5 (Berkeley) 06/27/91
1044957Scael.\"
1147314Scael.Vx
1244957Scael.Dd
1344957Scael.Dt SLEEP 1
1447314Scael.Os
1544957Scael.Sh NAME
1644957Scael.Nm sleep
1744957Scael.Nd suspend execution for an interval of time
1844957Scael.Sh SYNOPSIS
1944957Scael.Nm sleep
2044957Scael.Ar seconds
2144957Scael.Sh DESCRIPTION
2244957ScaelThe
2344957Scael.Nm sleep
2444957Scaelcommand
2544957Scaelsuspends execution for a minimum of
2644957Scael.Ar seconds .
2744957Scael.Nm Sleep
2844957Scaelis used to schedule the execution of other commands (see
2944957ScaelEXAMPLES below).
3044957Scael.Pp
3144957ScaelThe
3244957Scael.Nm Sleep
3344957Scaelutility exits with one of the following values:
3444957Scael.Tw Ds
3544957Scael.Tp Li \&0
3644957ScaelOn successful completetion, or if the signal SIGALRM was received.
3744957Scael.Tp Li \&>\&0
3844957ScaelAn error occurred.
3944957Scael.Tp
4044957Scael.Sh EXAMPLES
4144957ScaelTo schedule the execution of a command for
4244957Scael.Va x
4344957Scaelnumber seconds later:
4444957Scael.Pp
4544957Scael.Dl (sleep 1800; sh command_file >& errors)&
4644957Scael.Pp
4744957ScaelThis incantation would wait a half hour before
4844957Scaelrunning the script command_file. (See the
4944957Scael.Xr at 1
5044957Scaelutility.)
5144957Scael.Pp
5244957ScaelTo reiteratively run a command (with the
5344957Scael.Xr csh 1 ) :
5444957Scael.Pp
5544957Scael.Ds I
5644957Scaelwhile (1)
5744957Scael	if (! -r zzz.rawdata) then
5844957Scael		sleep 300
5944957Scael	else
6044957Scael		foreach i (`ls *.rawdata`)
6144957Scael			sleep 70
6244957Scael			awk -f collapse_data $i >> results
6344957Scael		end
6444957Scael		break
6544957Scael	endif
6644957Scaelend
6744957Scael.De
6844957Scael.Pp
6944957ScaelThe scenario for a script such as this might be: a program currently
7044957Scaelrunning is taking longer than expected to process a series of
7144957Scaelfiles, and it would be nice to have
7244957Scaelanother program start processing the files created by the first
7344957Scaelprogram as soon as it is finished (when zzz.rawdata is created).
7444957ScaelThe script checks every five minutes for the file zzz.rawdata,
7544957Scaelwhen the file is found, then another portion processing
7644957Scaelis done curteously by sleeping for 70 seconds in between each
7744957Scaelawk job.
7844957Scael.Sh SEE ALSO
7944957Scael.Xr setitimer 2 ,
8044957Scael.Xr alarm 3 ,
8144957Scael.Xr sleep 3 ,
8244957Scael.Xr at 1
8344957Scael.Sh STANDARDS
8444957ScaelThe sleep function is expected to be POSIX 1003.2 compatible.
85