Site Tools


on_signal

Synopsis:

on [<modes>]signal [<serial#>] [-|^]<match> { <action> }

Description:

This hook is triggered whenever an OS signal is received by the client.

Parameters:

$0 symbolic name or number of the signal received (eg. “1” or “HUP”)
$1 signal count, the number of times this signal has remaining to be processed in this iteration of the main client loop.

This hook will be triggered twice for each signal, once for the signal number and once for the symbolic name. Using the symbolic name in scripts is preferred, because the signal numbers can vary between operating systems.

It is unclear how to make any sensible use of the signal count parameter, and this should probably be ignored.

Examples:

To close and reopen all open log files when a SIGUSR1 signal is received:

 on ^signal "USR1 %" {
    fe ($logctl(REFNUMS ACTIVE)) logref {
       xecho -b Reopening log file $logctl(GET $logref FILENAME)
       @ logctl(SET $logref STATUS 0)
       @ logctl(SET $logref STATUS 1)
    }
 }
on_signal.txt · Last modified: 2017/07/06 01:48 by 127.0.0.1