on [<modes>]signal [<serial#>] [-|^]<match> { <action> }
This hook is triggered whenever an OS signal is received by the client.
$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.
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) } }