【发布时间】:2022-08-15 18:24:35
【问题描述】:
在documentation of supervisord 中,他们提到了不同停止信号的列表:TERM, HUP, INT, QUIT, KILL, USR1, USR2
这些停止信号的详细区别是什么?我有一个场景,我想向应该停止的进程发送一个等于键盘中断的信号。以上哪个是正确的?
标签: supervisord
在documentation of supervisord 中,他们提到了不同停止信号的列表:TERM, HUP, INT, QUIT, KILL, USR1, USR2
这些停止信号的详细区别是什么?我有一个场景,我想向应该停止的进程发送一个等于键盘中断的信号。以上哪个是正确的?
标签: supervisord
我相信这些选项指的是 Linux Signals。您可以在手册页上阅读更多信息 - https://man7.org/linux/man-pages/man7/signal.7.html 或查看下表摘自这篇更具描述性的文章 - https://www.computerhope.com/unix/signals.htm
作为手册页的详细信息,SIGINT(INT)发送Interrupt from keyboard 是正确的选择。
| Signal | Description |
|---|---|
| SIGTERM | The TERM signal is sent to a process to request its termination. Unlike the KILL signal, it can be caught and interpreted or ignored by the process. This signal allows the process to perform nice termination releasing resources and saving state if appropriate. It should be noted that SIGINT is nearly identical to SIGTERM. |
| SIGHUP | The HUP signal is sent to a process when its controlling terminal is closed. It was originally designed to notify a serial line drop (HUP stands for "Hang Up"). In modern systems, this signal usually indicates the controlling pseudo or virtual terminal is closed. |
| SIGINT | The INT signal is sent to a process by its controlling terminal when a user wants to interrupt the process. This signal is often initiated by pressing Ctrl+C, but on some systems, the "delete" character or "break" key can be used. |
| SIGQUIT | The QUIT signal is sent to a process by its controlling terminal when the user requests that the process perform a core dump. |
| SIGKILL | Forcefully terminate a process. With STOP, this is one of two signals which cannot be intercepted, ignored, or handled by the process itself. |
| SIGUSR1 | User-defined signal 1. This is one of two signals designated for custom user signal handling. |
| SIGUSR2 | User-defined signal 2. This is one of two signals designated for custom user signal handling. |
【讨论】: