![]() | :: | Software | :: | signal |
sigalarm [ -a -s sig ] timeout progwhere timeout is a number of seconds to wait before delivering a signal and prog is one or more arguments specifying a program to run.
The sigalarm sets an alarm for timeout seconds. Options are:
-a sig: Set alarm and execute prog.
-s sig: Fork and exec prog. Deliver sig to prog if the alarm goes off.
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.