Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

alarm(2) [linux man page]

ALARM(2)						     Linux Programmer's Manual							  ALARM(2)

NAME
alarm - set an alarm clock for delivery of a signal SYNOPSIS
#include <unistd.h> unsigned int alarm(unsigned int seconds); DESCRIPTION
alarm() arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds. If seconds is zero, no new alarm() is scheduled. In any event any previously set alarm() is canceled. RETURN VALUE
alarm() returns the number of seconds remaining until any previously scheduled alarm was due to be delivered, or zero if there was no pre- viously scheduled alarm. CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD. NOTES
alarm() and setitimer(2) share the same timer; calls to one will interfere with use of the other. sleep(3) may be implemented using SIGALRM; mixing calls to alarm() and sleep(3) is a bad idea. Scheduling delays can, as ever, cause the execution of the process to be delayed by an arbitrary amount of time. SEE ALSO
gettimeofday(2), pause(2), select(2), setitimer(2), sigaction(2), signal(2), sleep(3), time(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-06-12 ALARM(2)

Check Out this Related Man Page

ALARM(3)						   BSD Library Functions Manual 						  ALARM(3)

NAME
alarm -- set signal timer alarm LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> unsigned alarm(unsigned seconds); DESCRIPTION
This interface is made obsolete by setitimer(2). The alarm() function sets a timer to deliver the signal SIGALRM to the calling process after the specified number of seconds. If an alarm has already been set with alarm() but has not been delivered, another call to alarm() will supersede the prior call. The request alarm(0) voids the current alarm and the signal SIGALRM will not be delivered. Due to setitimer(2) restriction the maximum number of seconds allowed is 100000000. RETURN VALUES
The return value of alarm() is the amount of time left on the timer from a previous call to alarm(). If no alarm is currently set, the return value is 0. SEE ALSO
setitimer(2), sigaction(2), sigpause(2), sigvec(2), signal(3), sleep(3), ualarm(3), usleep(3) HISTORY
An alarm() function appeared in Version 7 AT&T UNIX. BSD
April 19, 1994 BSD
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Time

I have a Solaris 2.6 machine and I execute the following: while do echo looping sleep 15 done I would assume the looping would be printed every 15 seconds but it doesn't. consecutive looping gets printed without a 15 second gap. Any idea what might be the reason ? Thanks (9 Replies)
Discussion started by: brv
9 Replies

2. Programming

generating timer

I'm trying generate an interrupt every 1 seconds using itimer and My clock is not running. This is what i did : printf("about to sleep for 1 second \n"); signal(SIGALRM, wakeup); //myTimer.it_interval.tv_sec=0; //myTimer.it_interval.tv_usec =0; ... (5 Replies)
Discussion started by: Confuse
5 Replies

3. Windows & DOS: Issues & Discussions

I need a free firewall besides zone alarm for XP PRO

Please help. Reply and tell me if you find one. Lots of thanks! Computek (6 Replies)
Discussion started by: computek
6 Replies

4. Shell Programming and Scripting

Perl alarm signal

I am trying to write a signal to exit when a process times out. What I have come up with from poking around the web is this. #!/usr/bin/perl eval { local $SIG{ALRM} = sub { die "alarm clock restart" }; alarm 10; open(DSMADMC, "dsmadmc -se=tsmpc1 -id=XXXXX... (2 Replies)
Discussion started by: reggiej
2 Replies

5. SCO

Raid5 Failure

Forgive me, I do not know much about RAID so I'm going to be as detailed as possible. This morning, our server's alarm was going. I found that one of our drives have failed. (we have 3) It is an Adaptec ATA RAID 2400A controller I'm purchasing a new SCSI drive today. My questions: ... (2 Replies)
Discussion started by: gseyforth
2 Replies

6. Programming

Basic signal and alarm usage

I am trying to write a program that will; 1) Show the message "Snoozing now...zzzz" on the screen for 5 seconds 2) Then in the same position show the message "The ALARM is going off now!" for 5 seconds 3) Repeat 1) then 2) infinitely until user presses Ctrl C I can't make it work. Any hints... (17 Replies)
Discussion started by: enuenu
17 Replies

7. Shell Programming and Scripting

awk help

I have a raw data with some formats: * 11 REPT:CELL 55 ASSEMBLAGE 1 ALARM SCANNING SCAN POINT: ALARM GROUP 2, ALARM ID 11 ALARM: RECTIFIER MINOR ALARM STATE: OFF NORMAL 11 REPT:CELL 55 ASSEMBLAGE 1 ALARM SCANNING SCAN POINT: ALARM GROUP 2, ALARM ID 11 ALARM:... (3 Replies)
Discussion started by: anhtt
3 Replies

8. Shell Programming and Scripting

Need Help !!! simple query

Dear, I have a alarm text file, containing minor and major alarms, i am intrested in Mojor alarm with its alarm header and next four lines in seperate file.... Can anybody help me with this below is the alarm file output. :SEV="MAJOR": Object-Instance % unit-type % bts nbr % 25 ... (5 Replies)
Discussion started by: Danish Shakil
5 Replies

9. Shell Programming and Scripting

Script searchs into a file

Dear Sirs, I want to write a script as an automatic action when I receive an alarm from a specific application. There are some variables attached to this alarm, one of them is an (ID) that represents some data. Example: ID Responder COS 5 6OCT2-R50C-GZ-EG Default... (2 Replies)
Discussion started by: ahmed.zaher
2 Replies

10. Shell Programming and Scripting

Sometimes my until loop misses it's target

Hello all, I wrote a quick function (alarm) in my bash_profile (in cygwin) for practice. It uses until loops to wait for a specified time, and once that time passes triggers a play on a mp3. Most of the time it works, however sometimes it seems like it's looping through too slowly and will miss... (1 Reply)
Discussion started by: DeCoTwc
1 Replies

11. Shell Programming and Scripting

Delete 2 months before old files when we get alarm directory size > 90%

Please Help me Question: - we manually moving/removing old files, when we are getting alarm as /dir1/dir2 size greater than 90%. we manually moving/removing old files and reduce the file size to less than 90% - I want to delete all 2months before old files once we get the thresh hold >= 90%... (3 Replies)
Discussion started by: piyus
3 Replies

12. Shell Programming and Scripting

crontab+mplayer alarm clock

I'm trying to run a alarm.sh using crontab, which play a song as an alarm at 6.15 am. I'm using amixer so that volume increases by 10% in every loop. My script is the following. SHELL=/bin/bash PLAYER=/usr/bin/mplayer SONG=/home/hbar/Music/song.mp3 DISPLAY=:0.0 15 06 * * *... (10 Replies)
Discussion started by: hbar
10 Replies

13. UNIX for Dummies Questions & Answers

Print events from two lines with a common identifier

Hi Unix Gurus, I have a long text file, where alarms events are logged and alarm clear event are logged. Both events alarm and alarm clear has common identifier as{xxxxxxxxxx} I need to analyse the time-period for which the alarm sustained. i.e Output: timestamp from both event has... (3 Replies)
Discussion started by: vanand420
3 Replies

14. Shell Programming and Scripting

Need help in restarting process

Hi friends, I have one unix command which is used to check the network status manually. followig is the command check_Network this command give follwoing status Network 1 is ok Network 2 is ok network 3 is ok network 4 is ok . . . . Network 10 is... (8 Replies)
Discussion started by: Nakul_sh
8 Replies

15. Shell Programming and Scripting

Creating a monitoring alarm every hour in UNIX

Hi, I need to create a monitoring alarm script which would check if the log file has been updated in the last one hour or not. I tried using -cmin however, one environment supports it where as the other does not. I would really need some help here!!! (2 Replies)
Discussion started by: Ritu245
2 Replies