|
|
1.1 ! root 1: .\" Copyright (c) 1990 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)sleep.1 6.3 (Berkeley) 7/24/90 ! 19: .\" ! 20: .Dd July 24, 1990 ! 21: .Dt SLEEP 1 ! 22: .Os BSD 4.4 ! 23: .Sh NAME ! 24: .Nm sleep ! 25: .Nd suspend execution for an interval of time ! 26: .Sh SYNOPSIS ! 27: .Nm sleep ! 28: .Ar seconds ! 29: .Sh DESCRIPTION ! 30: The ! 31: .Nm sleep ! 32: command ! 33: suspends execution for a minimum of ! 34: .Ar seconds . ! 35: .Nm Sleep ! 36: is used to schedule the execution of other commands (see ! 37: EXAMPLES below). ! 38: .Pp ! 39: The ! 40: .Nm Sleep ! 41: utility exits with one of the following values: ! 42: .Tw Ds ! 43: .Tp Li \&0 ! 44: On successful completetion, or if the signal SIGALRM was received. ! 45: .Tp Li \&>\&0 ! 46: An error occurred. ! 47: .Tp ! 48: .Sh EXAMPLES ! 49: To schedule the execution of a command for ! 50: .Va x ! 51: number seconds later: ! 52: .Pp ! 53: .Dl (sleep 1800; sh command_file >& errors)& ! 54: .Pp ! 55: This incantation would wait a half hour before ! 56: running the script command_file. (See the ! 57: .Xr at 1 ! 58: utility.) ! 59: .Pp ! 60: To reiteratively run a command (with the ! 61: .Xr csh 1 ) : ! 62: .Pp ! 63: .Ds I ! 64: while (1) ! 65: if (! -r zzz.rawdata) then ! 66: sleep 300 ! 67: else ! 68: foreach i (`ls *.rawdata`) ! 69: sleep 70 ! 70: awk -f collapse_data $i >> results ! 71: end ! 72: break ! 73: endif ! 74: end ! 75: .De ! 76: .Pp ! 77: The scenario for a script such as this might be: a program currently ! 78: running is taking longer than expected to process a series of ! 79: files, and it would be nice to have ! 80: another program start processing the files created by the first ! 81: program as soon as it is finished (when zzz.rawdata is created). ! 82: The script checks every five minutes for the file zzz.rawdata, ! 83: when the file is found, then another portion processing ! 84: is done curteously by sleeping for 70 seconds in between each ! 85: awk job. ! 86: .Sh SEE ALSO ! 87: .Xr setitimer 2 , ! 88: .Xr alarm 3 , ! 89: .Xr sleep 3 , ! 90: .Xr at 1 ! 91: .Sh STANDARDS ! 92: The sleep function is expected to be POSIX 1003.2 compatible.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.