Add log file close and reopen on receipt of SIGUSR1

This commit is contained in:
Richard Shepherd 2017-08-11 11:04:58 +01:00 committed by Ludovic Fernandez
parent 64b8fc52c3
commit 4e5fcac9cb
12 changed files with 343 additions and 25 deletions

View file

@ -15,7 +15,6 @@ import (
"regexp"
"sort"
"sync"
"syscall"
"time"
"github.com/containous/mux"
@ -78,7 +77,7 @@ func NewServer(globalConfiguration GlobalConfiguration) *Server {
server.signals = make(chan os.Signal, 1)
server.stopChan = make(chan bool, 1)
server.providers = []provider.Provider{}
signal.Notify(server.signals, syscall.SIGINT, syscall.SIGTERM)
server.configureSignals()
currentConfigurations := make(configs)
server.currentConfigurations.Set(currentConfigurations)
server.globalConfiguration = globalConfiguration
@ -426,13 +425,6 @@ func (server *Server) startProviders() {
}
}
func (server *Server) listenSignals() {
sig := <-server.signals
log.Infof("I have to go... %+v", sig)
log.Info("Stopping server")
server.Stop()
}
func createClientTLSConfig(tlsOption *TLS) (*tls.Config, error) {
if tlsOption == nil {
return nil, errors.New("no TLS provided")