Closed Chen-Litao closed 4 months ago
换成syscall.SIGSTOP
是的,kill 有点粗暴了哈哈,我改一下子
看了一下代码,感觉是弄错了,我以为是直接 SIGKILL 呢, 现在用的 SIGTERM 是 ok 的。 几个 signal 的区别:
SIGKILL kills a process and cannot be caught
SIGTERM kills a process but can be caught to do a graceful exit
SIGSTOP suspends the process until you do a SIGCONT
然后 Docker 的描述
docker stop 就是停止容器,不是暂停容器,因此不是用的 SIGSTOP
好的好的,感谢回复
请问一下第十二课中
// 2.发送SIGTERM信号 if err = syscall.Kill(pidInt, syscall.SIGTERM); err != nil { log.Errorf("Stop container %s error %v", containerId, err) return }
syscall.SIGTERM换成syscall.SIGTERM是否更合适一点呢