Sponsored Content
Top Forums Programming performing a task at regular intervals Post 89506 by *nix on Monday 14th of November 2005 03:00:11 AM
Old 11-14-2005
UNIX supports about 30 signals, each with a unique integer code. You can program the current process to react to a particular signal in one of these ways.

React according to the default, which is to terminate, do nothing, or possibly dump core
Ignore the signal
Execute a user-supplied signal handler function

In addition, you can program the current process to block certain signals. Blocked signals are queued and only delivered if they are unblocked.

If you want a reminder of a timeout you can set the SIGALRM signal to the current process. Write a signal handler for the same and perform your operations there.

However there are two ways of implementing UNIX signal. SYSV and BSD style. The BSD style is more efficient.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date Intervals

I posted a question on date intervals about a month back asking about how I could be able to go about a user entering the starting year/month/day and an ending year/month/day and then the script automatically cycling through each day of each month of each year that the user has specified. I... (7 Replies)
Discussion started by: yongho
7 Replies

2. Shell Programming and Scripting

mailing myself at regular intervals...

hi all, i wrote a script to mail myself using pine (modified) to keep remind of b'days. #!/bin/bash grep "`date +%D |awk -F/ '{print $2+1, $1+0}'`" dataFile >/home/username/mailme if test -s /home/username/mailme then pine -I '^X,y' -subject "Birthday Remainder" username... (4 Replies)
Discussion started by: timepassman
4 Replies

3. Shell Programming and Scripting

comment and Uncomment single task out of multiple task

I have a file contains TASK gsnmpproxy { CommandLine = $SMCHOME/bin/gsnmpProxy.exe } TASK gsnmpdbgui { CommandLine = $SMCHOME/bin/gsnmpdbgui.exe I would like to comment and than uncomment specific task eg TASK gsnmpproxy Pls suggest how to do in shell script (9 Replies)
Discussion started by: madhusmita
9 Replies

4. Shell Programming and Scripting

Pls Help me out ... I want to check process status at regular intervals of time

I want to check process status at regular interval of time ... so i ha wirtten this BUT its not working when i placed this peace of code in .sh .. please help me out #!/bin/sh w = ps -ef|grep processname | wc - l echo $w if ; then Banner "Proceesname Problem" else Banner " Running... (5 Replies)
Discussion started by: srinivasvandana
5 Replies

5. Shell Programming and Scripting

Parse an XML task list to create each task.xml file

I have an task definition listing xml file that contains a list of tasks such as <TASKLIST <TASK definition="Completion date" id="Taskname1" Some other <CODE name="Code12" <Parameter pname="Dog" input="5.6" units="feet" etc /Parameter> <Parameter... (3 Replies)
Discussion started by: MissI
3 Replies

6. Shell Programming and Scripting

Divide numbers into intervals

divide input values into specified number (-100 or -200) according to the key (a1 or a2 ....) For ex: if we give -100 in the command line it would create 100 number intervals (1-100, 100-200, 200-300) untill it covers the value 300 in a1. Note: It should work the same even with huge numbers... (3 Replies)
Discussion started by: ruby_sgp
3 Replies

7. Shell Programming and Scripting

Remove a block of Text at regular intervals

Hello all, I have a text files that consists of blocks of text. Each block of text represents a set of Cartesian coordinates for a molecule. Each block of text starts with a line that has a only a number, which is equal to the total number of atoms in the molecule. After this number is a line... (15 Replies)
Discussion started by: marcozd
15 Replies

8. Programming

Selecting files in regular intervals from a folder

Hi, I need your expertise in selecting files from a folder. I have files named with convention: filename.i.j where j is an interger from 1 to 16, for each i which is an integer from 1 to 2000. I would like to select the files with i in regular interval of 50 like filename.1.j,... (2 Replies)
Discussion started by: rpd25
2 Replies

9. UNIX for Dummies Questions & Answers

Bulk load testing in regular intervals

I need to write a script which can send files via sftp communication continously for half an hour or any given duration of time. I have already written a batch file to send multiple file via SFTP. but I need to know how can we set a duration of half an hour through shell script. Can we use sleep... (2 Replies)
Discussion started by: talk1234
2 Replies

10. UNIX for Dummies Questions & Answers

Building intervals

Hi all, I hope you can help me with the following question: I have multiple tables like this: Chr Start End Zygosity Gene chr1 153233510 153233510 het LOR chr1 153233615 153233615 hom LOR chr1 153233701 153233701 hom LOR chr1 ... (5 Replies)
Discussion started by: lsantome
5 Replies
sigsuspend(2)							System Calls Manual						     sigsuspend(2)

NAME
sigsuspend - Atomically changes the set of blocked signals and waits for a signal LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <signal.h> int sigsuspend ( const sigset_t *signal_mask ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: sigsuspend(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a set of signals. DESCRIPTION
The sigsuspend() function replaces the signal mask of the process (or thread) with the set of signals pointed to by the signal_mask parame- ter, and then suspends execution of the caller until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process. The sigsuspend() function does not allow the SIGKILL or SIGSTOP signals to be blocked. If a program attempts to block one of these signals, the sigsuspend() function gives no indication of the error; the illegal request is simply ignored. If delivery of a signal causes the process to terminate, the sigsuspend() function does not return. If delivery of a signal causes a sig- nal-catching function to execute, the sigsuspend() function returns after the signal-catching function returns, with the signal mask restored to the set that existed prior to the call to the sigsuspend() function. The sigsuspend() function sets the signal mask and waits for an unblocked signal as one atomic operation. This means that signals cannot occur between the operations of setting the mask and waiting for a signal. If a program invokes sigprocmask(SIG_SETMASK) and sigpause() separately, a signal that occurs between these functions might not be noticed by sigpause(). In normal usage, a signal is blocked by using the sigprocmask(SIG_BLOCK,...) or pthread_sigmask(...) function at the beginning of a crit- ical section. The process then determines whether there is work for it to do. If no work is to be done, the process waits for work by call- ing the sigsuspend() function with the mask previously returned by the sigprocmask() function. NOTES
The sigpause() function is provided for compatibility with older UNIX systems; its function is a subset of the sigsuspend() function. RETURN VALUES
Since the sigsuspend() function suspends process execution indefinitely, there is no successful completion return value. If a return occurs, -1 is returned and errno is set to indicate the error. ERRORS
The sigsuspend() function sets errno to the specified values for the following conditions: A signal is caught by the calling process and control is returned from the signal-catching function. RELATED INFORMATION
Functions: pause(3), sigaction(2), sigblock(2), sigprocmask(2), sigvec(2) Standards: standards(5) delim off sigsuspend(2)
All times are GMT -4. The time now is 01:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy