Closed PavelPolyakov closed 10 years ago
You can use the os/signal package to catch external signals and relay them to your server:
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, os.Kill)
go func() {
<-c
server.Shutdown <- true
}()
Thanks,
That's a solution, but, as I found today the os.Kill signal, actually cannot be catched: https://groups.google.com/forum/#!topic/golang-nuts/t2u-RkKbJdU
Hi,
Could you clarify for me - which way I should send the message to the server. Shutdown ?
My real goal (why I'm actually here) is to know how can I build the web server, which I can restart in the same way as apache, for example.
Like
service apache2 restart
Using your concept, I think it's possible to do the "stop" operation, at least. Could you clarify how can I, from the external environment, put the message to the server.Shutdown channel?
Thanks