1 Star 0 Fork 871

woshizhendezilong / proxy

forked from 狂奔的蜗牛. / goproxy 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 817 Bytes
一键复制 编辑 原始数据 按行查看 历史
arraykeys@gmail.com 提交于 2018-03-05 18:46 . prepare for sps
package main
import (
"log"
"os"
"os/signal"
"snail007/proxy/services"
"syscall"
)
const APP_VERSION = "4.4"
func main() {
err := initConfig()
if err != nil {
log.Fatalf("err : %s", err)
}
if service != nil && service.S != nil {
Clean(&service.S)
} else {
Clean(nil)
}
}
func Clean(s *services.Service) {
signalChan := make(chan os.Signal, 1)
cleanupDone := make(chan bool)
signal.Notify(signalChan,
os.Interrupt,
syscall.SIGHUP,
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGQUIT)
go func() {
for _ = range signalChan {
log.Println("Received an interrupt, stopping services...")
if s != nil && *s != nil {
(*s).Clean()
}
if cmd != nil {
log.Printf("clean process %d", cmd.Process.Pid)
cmd.Process.Kill()
}
cleanupDone <- true
}
}()
<-cleanupDone
}
Go
1
https://gitee.com/woshizhendezilong/proxy.git
git@gitee.com:woshizhendezilong/proxy.git
woshizhendezilong
proxy
proxy
master

搜索帮助