Many Unix programs accept signals like USR1
and USR2
. For example, to upgrade the executable for Nginx on the fly, you send kill -USR2
.
I understand that USR1
is a "user defined" signal, meaning that whoever created the program can use it to mean "shut down" or "dump your logs" or "print foo a thousand times" or whatever. But I don't understand why they must use this arbitrary name. Why not kill -UPGRADE
, or kill -GRACEFUL_SHUTDOWN
? Does Unix only allow specific signals?
While we're at it, Nginx also uses the following signals (see documentation):
- TERM, INT: Quick shutdown
- QUIT: Graceful shutdown
- HUP:
- Configuration reload
- Start the new worker processes with a new configuration
- Gracefully shutdown the old worker processes
- USR1: Reopen the log files
- USR2: Upgrade Executable on the fly
- WINCH: Gracefully shutdown the worker processes
HUP? WINCH? What's the reason for these names? Where can I learn more about this?
man signal
discusses signals and lists 31 of them. – Inheritrix