From feb516b75dd439acb91d1a7dfdfce7aaa7cfa34b Mon Sep 17 00:00:00 2001 From: "dev.sungmin.kim" Date: Wed, 5 Sep 2012 11:10:07 +0900 Subject: [PATCH] [Title] // add exception process in build-svr [Type] // [Module] // [Priority] // [CQ#] // [Redmine#] // [Problem] // [Cause] // [Solution] // [TestCase] // --- build-svr | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/build-svr b/build-svr index 7434c32..fd881ff 100755 --- a/build-svr +++ b/build-svr @@ -86,29 +86,33 @@ begin BuildServerController.start_server( option[:name], option[:port] ) else # Parent Process log = Log.new( "#{BuildServer::CONFIG_ROOT}/#{option[:name]}/main.log" ) - while(true) - log.info "Build Server[#{option[:name]}] Start - PORT:[#{option[:port]}]" - # Start child process - cmd = Utils.execute_shell_generate("#{File.dirname(__FILE__)}/build-svr start -n #{option[:name]} -p #{option[:port]} --CHILD") - IO.popen(cmd) - pid = Process.wait - - # End chlid process - log.info "Child process terminated, pid = #{pid}, status = #{$?.exitstatus}" - if ($?.exitstatus == 0) then # SERVER STOP COMMAND - log.info "Down Build Server." - break - elsif ($?.exitstatus == 99) then # DIBS UPGRADE - cmd = "#{File.dirname(__FILE__)}/upgrade -l #{File.dirname(__FILE__)} -S -t BUILDSERVER -n #{option[:name]} -p #{option[:port]}" - cmd = Utils.execute_shell_generate(cmd) - puts cmd - Utils.spawn(cmd) - log.info cmd - log.info "Down Build Server for DIBS upgrade." - break - else - log.error "Down Build Server. Try reboot Build Server." + begin + while(true) + log.info "Build Server[#{option[:name]}] Start - PORT:[#{option[:port]}]" + # Start child process + cmd = Utils.execute_shell_generate("#{File.dirname(__FILE__)}/build-svr start -n #{option[:name]} -p #{option[:port]} --CHILD") + IO.popen(cmd) + pid = Process.wait + + # End chlid process + log.info "Child process terminated, pid = #{pid}, status = #{$?.exitstatus}" + if ($?.exitstatus == 0) then # SERVER STOP COMMAND + log.info "Down Build Server." + break + elsif ($?.exitstatus == 99) then # DIBS UPGRADE + cmd = "#{File.dirname(__FILE__)}/upgrade -l #{File.dirname(__FILE__)} -S -t BUILDSERVER -n #{option[:name]} -p #{option[:port]}" + cmd = Utils.execute_shell_generate(cmd) + puts cmd + Utils.spawn(cmd) + log.info cmd + log.info "Down Build Server for DIBS upgrade." + break + else + log.error "Down Build Server. Try reboot Build Server." + end end + rescue => e + log.error( e.message, Log::LV_USER) end end when "stop" -- 2.34.1