sleepenh (1) - Linux Man Pages
sleepenh: an enhanced sleep program.
sleepenh - an enhanced sleep program.
SYNOPSISsleepenh [initial-time] sleep-time
DESCRIPTIONsleepenh is a program that can be used when there is a need to execute some functions periodically in a shell script. It was not designed to be accurate for a single sleep, but to be accurate in a sequence of consecutive sleeps.
After a successful execution, it returns to stdout the timestamp it finished running, that can be used as initial-time to a successive execution of sleepenh.
OPTIONSThere are no command line options. Run it without any option to get a brief help and version.
ARGUMENTSsleep-time is a real number in seconds, with microseconds resolution (1 minute, 20 seconds and 123456 microseconds would be 80.123456).
initial-time is a real number in seconds, with microseconds resolution. This number is system dependent. In GNU/Linux systems, it is the number of seconds since midnight 1970-01-01 GMT. Do not try to get a good value of initial-time. Use the value supplied by a previous execution of sleepenh.
If you don't specify initial-time, it is assumed the current-time.
EXIT STATUSAn exit status greater or equal to 10 means failure. Known exit status:
- Success. There was no need to sleep. (means that initial-time + sleep-time was greater than current-time).
- Failure. Missing command line arguments.
- Failure. Did not receive SIGALRM.
- Failure. Argument is not a number.
- Failure. System error, could not get current time.
USAGE EXAMPLESuppose you need to send the char 'A' to the serial port ttyS0 every 4 seconds. This will do that:
while true; do
send the byte to ttyS0
"A" > /dev/ttyS0;
just print a nice message on screen
"I sent 'A' to ttyS0, time now is ";
wait the required time
HINTThis program can be used to get the current time. Just execute:
- sleepenh 0
BUGSIt is not accurate for a single sleep. Short sleep-times will also not be accurate.
SEE ALSOdate(1), sleep(1).
AUTHORThis manual page was written by Pedro Zorzenon Neto.
Linux man pages generated by: SysTutorials
Linux Man Pages Copyright Respective Owners. Site Copyright © SysTutorials. All Rights Reserved.