diff --git a/cmd/circologd/main.go b/cmd/circologd/main.go index b40641c..4d73150 100644 --- a/cmd/circologd/main.go +++ b/cmd/circologd/main.go @@ -32,7 +32,7 @@ func main() { flag.Parse() interrupt := make(chan os.Signal, 1) - signal.Notify(interrupt, syscall.SIGINT, syscall.SIGUSR1, syscall.SIGTERM) + signal.Notify(interrupt, syscall.SIGINT, syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGTERM) hub := circolog.NewHub(*bufsize) handler := syslog.NewChannelHandler(hub.LogMessages) @@ -115,6 +115,15 @@ func main() { log.Println("paused") } } + if sig == syscall.SIGUSR2 { + hub.Commands <- circolog.HubFullCommand{Command: circolog.CommandClear} + resp := <-hub.Responses + if resp.Value.(bool) { + log.Println("buffer cleaned") + } else { + log.Println("buffer NOT cleaned") + } + } if sig == syscall.SIGTERM || sig == syscall.SIGINT { log.Println("Quitting because of signal", sig) server.Kill()