Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sleep(3) [netbsd man page]

SLEEP(3)						   BSD Library Functions Manual 						  SLEEP(3)

NAME
sleep -- suspend process execution for interval of seconds LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> unsigned int sleep(unsigned int seconds); DESCRIPTION
The sleep() function suspends execution of the calling process until either the number of seconds specified by seconds have elapsed or a sig- nal is delivered to the calling process and its action is to invoke a signal-catching function or to terminate the process. The suspension time may be longer than requested due to the scheduling of other activity by the system. RETURN VALUES
If the sleep() function returns because the requested time has elapsed, the value returned will be zero. If the sleep() function returns due to the delivery of a signal, the value returned will be the unslept amount (the request time minus the time actually slept) in seconds. SEE ALSO
nanosleep(2), usleep(3) STANDARDS
The sleep() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1''). HISTORY
A sleep() function appeared in Version 7 AT&T UNIX. BSD
June 4, 1993 BSD

Check Out this Related Man Page

SLEEP(3)						   BSD Library Functions Manual 						  SLEEP(3)

NAME
sleep -- suspend thread execution for an interval measured in seconds LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> unsigned int sleep(unsigned int seconds); DESCRIPTION
The sleep() function suspends execution of the calling thread until either seconds seconds have elapsed or a signal is delivered to the thread and its action is to invoke a signal-catching function or to terminate the thread or process. System activity may lengthen the sleep by an indeterminate amount. This function is implemented using nanosleep(2) by pausing for seconds seconds or until a signal occurs. Consequently, in this implementa- tion, sleeping has no effect on the state of process timers, and there is no special handling for SIGALRM. RETURN VALUES
If the sleep() function returns because the requested time has elapsed, the value returned will be zero. If the sleep() function returns due to the delivery of a signal, the value returned will be the unslept amount (the requested time minus the time actually slept) in seconds. SEE ALSO
nanosleep(2), usleep(3) STANDARDS
The sleep() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1''). HISTORY
A sleep() function appeared in Version 7 AT&T UNIX. BSD
February 13, 1998 BSD
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

PHP Module

Ok..i've installed Apache 1.3.14, and it runs... BUT...I can't figure out how to get the php-4.0.4 module to run, and i've read through the install file and EVERYTYHING, aafter about 10 attempts I pissed myself off enough to goto sleep...Can anyone suggest a place to look for a lil bit more help?... (10 Replies)
Discussion started by: ComTec
10 Replies

2. UNIX for Dummies Questions & Answers

telnet in a script

I'm need to connect to another host in a script using the telnet command. How do I pass the login and password to be able to connect to the other host from within the script? (10 Replies)
Discussion started by: vaccari
10 Replies

3. Solaris

Remove Server Sleep Mode

Hi All, Need some help here. Can anyone tell me how to set or which start up script to edit in order not to set the server to sleep mode after a while of inactivity. My Unix server will go to sleep mode and then i always end up with a OK Prompt and have to reset the server. My Server is a V120... (16 Replies)
Discussion started by: alvintai
16 Replies

4. Shell Programming and Scripting

How to wakeup sleeping processes

Hi, Could someone please tell me how to wakeup sleeping processes? (i.e. change the process status from "S" to "R" when viewing in ps command). I ran a few programs in the background by "&" which went into "sleep" mode and I want them to run. Any help will be greatly appreciated. Steve (11 Replies)
Discussion started by: stevefox
11 Replies

5. Programming

Sleep or Dealy fucntion Issue

I am doing some programming using C on UNIX. The thing is, I have been working in both UNIX and Windows for practicing. I created a Delay fucntion over Windows using DevC++ as a compiler, when I tried over the console, it worked as I expected, I mean it was creating a delay (of one second for... (10 Replies)
Discussion started by: josejesus3340
10 Replies

6. Shell Programming and Scripting

Wants alternate to the Sleep option??

I am new to Shell Scripting and I need help to write the following script in a different format... This is the current script: #!/usr/bin/ksh environment=rms export environment . $AW_HOME/RETEK/exec/RETEK_ENVAR ls -ltr $MMPOS/RTLOG* | tr -s " " | cut -d " " -f9... (20 Replies)
Discussion started by: satyajit007
20 Replies

7. What is on Your Mind?

Do You Sleep With Battery Powered Devices?

Be Truthful :D Do you sleep with any battery powered devices? Select multiple choices if you do !! Suggest new devices to add to the poll !! (13 Replies)
Discussion started by: Neo
13 Replies

8. AIX

Read input data within a specified period of time

Hi All, I am working on a script which requires an input from user within one 1 min. So if the user gives the required input within 1 min., it will execute on the basis of input provided by the user.Other wise it will execute on a default value(hard coded inside the script). Now, I am... (19 Replies)
Discussion started by: rajsharma
19 Replies

9. Shell Programming and Scripting

script to check for existence of file (or else sleep for x time)

Hi Forum. I have a script that accepts 3 input parameters (source directory, list file text, sleep time) and checks for the presence of files. If not there, script goes to sleep for certain amount of time provided by 3rd input. list file text contains 1 entry but may contain more (file... (13 Replies)
Discussion started by: pchang
13 Replies

10. Programming

How to sleep and wake a thread???

Hi guys, I am creating two posix threads. I have some queries, hopefully you will help me out with them 1) How can I put a thread to indefinite sleep, for indefinite time period. I am familiar with this sleep(5); for 5 second, how can I make it indefinite?? 2) How can one thread wake another... (11 Replies)
Discussion started by: gabam
11 Replies

11. Shell Programming and Scripting

Help with trap and signals

I am having issues with trap not working inside a script. I am currently trying this on a Knoppix system V 5.1. What I would like to happen is when I press control c, a message gets echoed and the script is ended. For example: #! /bin/bash trap "echo CTRL c was pressed ; break" SIGINT... (11 Replies)
Discussion started by: Basherrr
11 Replies

12. Shell Programming and Scripting

Alternative to Sleep?

Greetings. I've been wondering about this one for some time: Is there an alternative to sleep in bash? The reason: I'd like to simply limit the amount of processor usage in continuous while : script scenarios without spawning endless sleep processes as well. After beating the manpages, I... (14 Replies)
Discussion started by: LinQ
14 Replies

13. Shell Programming and Scripting

Sleep command

I need help in script. I want my one script execute every time at 6:30 am and i have no cron access. So i am putting sleep command there , Script may took half an hour 35 min , it depend upon queries how much it take time, but that is not issue, So i want according to stop time of... (15 Replies)
Discussion started by: pallvi_mahajan
15 Replies

14. Shell Programming and Scripting

Send sleep to background

Hello all, I've a small script where it checks for the existence of a particular file and sleeps for 5 seconds if it doesn't exist. I would like to send the sleep output to background so that I don't see so many sleep messages in the build output. #!/bin/sh -x until do sleep 3 done echo... (17 Replies)
Discussion started by: builderj
17 Replies

15. UNIX for Beginners Questions & Answers

Sleep command did not worked

Hi All, We have a process which is running for last 2 years well and good in production. But suddenly yesterday there was issue we faced in the process. The actual process is what it does like below. 1. Receive the files in NAS directory(N/w attached storage). 2. Trigger the... (11 Replies)
Discussion started by: mad man
11 Replies