From 35835eb7364146abafffe9858ad78624034a0df9 Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 27 Mar 2018 18:34:28 +0900 Subject: [PATCH] ing --- server/server_handlers.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/server_handlers.go b/server/server_handlers.go index 01943dc..0321ac1 100644 --- a/server/server_handlers.go +++ b/server/server_handlers.go @@ -49,10 +49,6 @@ func (sh *ServerHandlers) Init(serverCTX server.ServerContext) error { return err } - if err := oocu.ExecuteStarters(sh.services, sh.servicesToStartAndStop, false); nil != err { - return err - } - return nil } @@ -72,6 +68,10 @@ func (sh *ServerHandlers) Listen(serverCTX server.ServerContext) (net.Listener, func (sh *ServerHandlers) OnStart(serverCTX server.ServerContext) { sh.ServerHandlers.OnStart(serverCTX) + if err := oocu.ExecuteStarters(sh.services, sh.servicesToStartAndStop, false); nil != err { + logging.Logger().Panicf("Cannot start services %v", err) + } + if _, err := os.Stat(sh.pidPathABS); os.IsExist(err) { if err := os.Remove(sh.pidPathABS); nil != err { logging.Logger().Errorf("Container: Removing pid file has been failed [%v]", err) @@ -89,13 +89,14 @@ func (sh *ServerHandlers) OnStop(serverCTX server.ServerContext) { } } + if err := oocu.ExecuteStoppers(sh.services, sh.servicesToStartAndStop, true); nil != err { + logging.Logger().Error(err) + } + sh.ServerHandlers.OnStop(serverCTX) } func (sh *ServerHandlers) Destroy(serverCTX server.ServerContext) { - if err := oocu.ExecuteStoppers(sh.services, sh.servicesToStartAndStop, true); nil != err { - logging.Logger().Error(err) - } sh.ServerHandlers.Destroy(serverCTX) }