golang处理signal

signal一般用来实现优雅重启,或者重新加载配置文件等操作。

废话不多说,上表格

动作号码信号golang
kill pid 15 SIGTERM terminated
kill -9 pid 9 SIGKILL killed (应用程序无法捕获)
kill -10 pid 10 SIGUSR1 user defined signal 1
kill -12 pid 12 SIGUSR2 user defined signal 2
ctrl+c 2 SIGINT interrupt
ctrl+z 20 SIGTSTP stopped
ctrl+ 3 SIGQUIT quit
kill -1 pid 1 SIGHUP operation not permitted (一般用来重新加载配置文件)

参考:

http://www.cnblogs.com/jkkkk/p/6180016.html 
http://blog.csdn.net/zzhongcy/article/details/50601079 
http://os.51cto.com/art/201006/203953.htm

原文地址:https://www.cnblogs.com/highend/p/golang_handler_signal.html