V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
funky
V2EX  ›  Go 编程语言

signal.Notify 监听不到 托管到 supervisor 服务的启动/停止信号

  •  
  •   funky · 329 天前 · 582 次点击
    这是一个创建于 329 天前的主题,其中的信息可能已经有所发展或是发生改变。

    如题所述,监听不到,但是启动的时候会有

    signal:urgent I/O condition
    
    julyclyde
        1
    julyclyde  
       328 天前
    先发代码和实验过程
    funky
        2
    funky  
    OP
       328 天前
    以下是伪代码
    ```
    shutdown:= make(chan os.Signal,1),
    signal.Notify(shutdown)
    go func() {
    for {
    ss := <-shutdown
    log.Printf("signal:%s", ss.String())
    return
    }
    }()
    ```
    我在其他的地方阻塞了主线程,当我用 supervisor 托管我的服务
    stop xxx(我的程序在 supervisor 的名称)
    日志没有任何打印
    start xxx(我的程序在 supervisor 的名称)
    日志过会才有打印
    ``` signal:urgent I/O condition ```
    julyclyde
        3
    julyclyde  
       327 天前
    那如果不在 supervisord 下面运行呢,可以正常收到么?
    funky
        4
    funky  
    OP
       327 天前
    不进行托管的话可以正常捕获
    funky
        5
    funky  
    OP
       327 天前
    @funky 挂载到 system service 就可以正常捕获到,看来 supervisor 和系统不一致
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1243 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 121ms · UTC 18:00 · PVG 02:00 · LAX 11:00 · JFK 14:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.