From 805e82dbdadb4ad151503f8aafe9c32187c1f000 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 15 Nov 2010 13:26:24 +0000 Subject: [PATCH] make sure xcatdb is running when db2sqlsetup is executed defect 3107948 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8161 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/db2sqlsetup | 52 +++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/xCAT-client/bin/db2sqlsetup b/xCAT-client/bin/db2sqlsetup index c14438baf..c81789b1f 100755 --- a/xCAT-client/bin/db2sqlsetup +++ b/xCAT-client/bin/db2sqlsetup @@ -261,6 +261,8 @@ if (($::INIT) && ($::xcatrunningdb2 == 0)) if ($::SERVER) { # setting up server + # makesure the daemon is running + &startxcatd; # # Backup current database # @@ -309,6 +311,7 @@ if (($::INIT) && ($::xcatrunningdb2 == 0)) { xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed."); + &startxcatd; exit(1); } } # end setting up SERVER @@ -389,17 +392,7 @@ if (($::INIT) && ($::xcatrunningdb2 == 0)) # # start the daemon # - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "$::XCATROOT/sbin/restartxcatd"; - - } - else - { - $xcmd = "service xcatd restart"; - } - system($xcmd); + &startxcatd; xCAT::MsgUtils->message("SI", "xCAT DB2 Client setup is complete.\n"); } } # end initialization @@ -443,6 +436,31 @@ sub usage xCAT::MsgUtils->message('I', "$msg"); } +#----------------------------------------------------------------------------- + +=head3 startxcatd + + start the daemon + +=cut + +#----------------------------------------------------------------------------- + +sub startxcatd + +{ + my $xcmd; + if ($::osname eq 'AIX') + { + $xcmd = "$::XCATROOT/sbin/restartxcatd"; + + } + else + { + $xcmd = "service xcatd restart"; + } + system($xcmd); +} #----------------------------------------------------------------------------- @@ -1460,17 +1478,7 @@ sub restorexcatdb # # start the daemon # - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "startsrc -s xcatd"; - - } - else - { - $xcmd = "service xcatd start"; - } - system($xcmd); + &startxcatd; } #-----------------------------------------------------------------------------