- Go get && import this repo
go get github.com/bitxel/socket
- Update code, change net.Listen to socket.Listen
l, err := socket.Listen("tcp", ":12345")
- Handle singal USR2 && run new binary
sigch := make(chan os.Signal, 1)
signal.Notify(sigch, syscall.SIGUSR2)
<-sigch
socket.Fork()
- Test
kill -USR2 pid