我总是很犹豫要不要跑kill -9,但我看到其他管理员几乎是例行公事。
我认为可能有一个明智的中间立场,所以:
kill -9使用?什么时候,为什么不呢?如果我想尽可能小心和礼貌地终止进程,
我应该在终止命令中使用哪些信号,以什么顺序?
我想给程序任何时间来清理,如果它愿意的话,所以只是发送一个SIGTERM将是苛刻的,我想?
我会最后使用SIGKILL(" -9"),这很清楚。
但是从哪个开始呢?SIGHUP? 哪些信号只是浪费时间?
相关信号供参考,来自
man 7 signal
Signal Value Action Comment
??????????????????????????????????????????????????????????????????????
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGKILL 9 Term Kill signal
SIGPIPE 13 Term Broken pipe: write to pipe with no
readers
SIGTERM 15 Term Termination signal
Run Code Online (Sandbox Code Playgroud)