add signal handler

tls
dingjun 6 years ago
parent 37e161a63f
commit 1a4351c626

@ -9,6 +9,8 @@ import (
"io/ioutil" "io/ioutil"
"net" "net"
"os" "os"
"os/signal"
"syscall"
"github.com/fangdingjun/go-log" "github.com/fangdingjun/go-log"
"github.com/fangdingjun/obfssh" "github.com/fangdingjun/obfssh"
@ -154,6 +156,12 @@ func main() {
} }
}(lst) }(lst)
} }
select {}
ch := make(chan os.Signal, 2)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
select {
case s := <-ch:
log.Printf("received signal %s, exit.", s)
}
} }

Loading…
Cancel
Save