4.4.2. The sleep command
The Info page on sleep is probably one of the shortest there is.
All sleep does is wait. By default the time
to wait is expressed in seconds.
So why does it exist? Some practical examples:
Somebody calls you on the phone, you say "Yes I'll be with you
in half an hour" but you're about drowned in work as it is and
bound to forget your lunch:
(sleep 1800; echo "Lunch
time..") &
When you can't use the at command for
some reason, it's five o'clock, you want to go home but there's
still work to do and right now somebody is eating system
resources:
(sleep 10000; myprogram) &
Make sure there's an auto-logout on your system, and that you
log out or lock your desktop/office when submitting this kind of
job, or run it in a screen session.
When you run a series of printouts of large files, but you want
other users to be able to print in between:
lp lotoftext; sleep
900; lp hugefile; sleep 900; lp anotherlargefile
Printing files is discussed in
Chapter 8.
Programmers often use the sleep command to halt script or
program execution for a certain time.