Skip to content
The Signal Belfry

/static/campanario/en/sino/sigusr2/

Menu

SIG-024 · The user's

SIGUSR2

The second free bell — the one that usually remains without an agreed ring.

SIGUSR1's sibling, with the same freedom and less fame. When a program has already spent the first signal on the obvious use, the second inherits the exotic one: in nginx, USR2 triggers the binary upgrade in mid flight, without dropping connections.

In scripts, the USR1/USR2 pair becomes a homemade two-button protocol — raise and lower verbosity, toggle a mode — for the price of two traps. The sibling's warning applies here too: with no handler, the default is to terminate.

$ cat vigia.sh
trap 'verbo=1' USR1
trap 'verbo=0' USR2
...
$ kill -USR2 $(pidof -s vigia.sh)
(the watcher goes back to silent mode)
Two free bells, one homemade protocol.