SuperScript :: Software :: signal

The sigalarm program

Usage

sigalarm [ -a -s sig ] timeout prog

where timeout is a number of seconds to wait before delivering a signal and prog is one or more arguments specifying a program to run.

Description

The -s option takes a signal as an argument and accepts a number or one of the (case insensitive) strings ALRM, CHLD, CONT, HUP, INT, PIPE, or TERM. The last -s or -a option takes precedence.

The sigalarm sets an alarm for timeout seconds. Options are:

The following invokations are equivalent:

sigalarm prog
sigalarm opts -a prog

Under -a, sigalarm sets an alarm for timeout seconds and executes prog. The child process inherits the alarm. Note that implementations of sleep use the alarm may interact poorly with sigalarm -a. With -s, sigalarm forks and execs prog, and delivers it a sig signal if timeout seconds elapse before the child exits. In either case, sigalarm exits with the same exit code as prog.

Copyright © 2009 by SuperScript Technology, Inc. All rights reserved.