sleep(1) — Commands
NAME
sleep − Suspends execution for a specified time
SYNOPSIS
sleep seconds
DESCRIPTION
The sleep command suspends execution of a process for the interval specified by seconds, which can range from 0 to 2,147,483,647 seconds.
seconds can be entered as a non-negative decimal, octal, or hexadecimal value.
NOTES
If sleep receives a SIGALARM signal before process execution has resumed, sleep terminates normally with a 0 (zero) exit status. (See the sleep() reference page for more information.)
EXAMPLES
1.To display a message at 4-minute intervals for 20 minutes, create a shell script called remind containing the following:
for i
do
sleep 240; echo $i
sleep 240; echo $i
sleep 240; echo $i
sleep 240; echo $i
sleep 240; echo $i
done
To display the message Try calling NHK at 4-minute intervals, enter:
remind ’Try calling NHK’
2.To run a command at regular intervals, create a shell script containing the following:
while true
do
date
sleep 60
done
This displays the date and time once a minute.
RELATED INFORMATION
Functions: alarm(3), pause(3), sigaction(2), sleep(3).