Browse Source

change log re-open signal to SIGUSR1 instead of SIGHUP

flashmob 8 years ago
parent
commit
28d75421cf
3 changed files with 5 additions and 4 deletions
  1. 2 1
      backends/p_guerrilla_db_redis.go
  2. 3 2
      cmd/guerrillad/serve.go
  3. 0 1
      server.go

+ 2 - 1
backends/p_guerrilla_db_redis.go

@@ -18,7 +18,8 @@ import (
 // ----------------------------------------------------------------------------------
 // Processor Name: GuerrillaRedsDB
 // ----------------------------------------------------------------------------------
-// Description   : Saves the body to redis, meta data to mysql. Example
+// Description   : Saves the body to redis, meta data to mysql. Example only.
+//               : Limitation: it doesn't save multiple recipients or validate them
 // ----------------------------------------------------------------------------------
 // Config Options: ...
 // --------------:-------------------------------------------------------------------

+ 3 - 2
cmd/guerrillad/serve.go

@@ -66,13 +66,14 @@ func sigHandler(app guerrilla.Guerrilla) {
 			if err != nil {
 				// new config will not be applied
 				mainlog.WithError(err).Error("Error while ReadConfig (reload)")
-				// re-open logs
-				cmdConfig.EmitLogReopenEvents(app)
 			} else {
 				cmdConfig = newConfig
 				mainlog.Infof("Configuration was reloaded at %s", guerrilla.ConfigLoadTime)
 				cmdConfig.emitChangeEvents(&oldConfig, app)
 			}
+		} else if sig == syscall.SIGUSR1 {
+			// re-open logs
+			cmdConfig.EmitLogReopenEvents(app)
 		} else if sig == syscall.SIGTERM || sig == syscall.SIGQUIT || sig == syscall.SIGINT {
 			mainlog.Infof("Shutdown signal caught")
 			app.Shutdown()

+ 0 - 1
server.go

@@ -6,7 +6,6 @@ import (
 	"fmt"
 	"io"
 	"net"
-	"runtime"
 	"strings"
 	"sync"
 	"sync/atomic"