douli1306
2019-05-05 19:14
浏览 176
已采纳

发送自定义信号到curreng Golang过程

I'm creating a HTTP server using Go. And whenever I work on a database maintenance, I want the server to redirect all the traffic to "current working on maintenance" page.

Currently, this is done by secret admin page (eg. http://myhome/secret) but I'm wondering if this can be done with signal -similar to TERM signal, but temporarily redirect rather than actually terminate the process.

Eg.

/home/myhome> nohup startServer &
... 
/home/myhome> changeMyServerStatus "maintenance"

I assume there will be two executable.. "startServer" and "changeMyServerStatus"

So, this is similar to a service. (like reload) But, is this possible? If so, can you give me some hint please?

Thank you

1条回答 默认 最新

相关推荐 更多相似问题