From d0909749b52147f52d38dc5c7e11768e249c4a19 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 5 Apr 2011 18:03:45 +0000 Subject: [PATCH] add workaround to setup DB2 to come up after reboot on Linux. Check to see if writable directory when running -o option on AIX git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9228 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/db2sqlsetup | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/xCAT-client/bin/db2sqlsetup b/xCAT-client/bin/db2sqlsetup index 657655c5f..8338dcc56 100755 --- a/xCAT-client/bin/db2sqlsetup +++ b/xCAT-client/bin/db2sqlsetup @@ -1274,6 +1274,52 @@ sub db2reboot xCAT::MsgUtils->message("W", " $cmd failed."); } + # if on Linux redhat6 , we need to setup /etc/init.d + # this is a workaround until DB2 no longer uses /etc/inittab on Linux + + if ($::osname eq 'Linux') { + # check to see DB2 has not already implemented a script in /etc/inittab + $cmd = " fgrep db2fmcd /etc/init.d/*"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) { + my $message = "DB2 /etc/init.d reboot file already setup"; + xCAT::MsgUtils->message("I", "$message"); + } else { + $cmd = "cp /opt/xcat/share/xcat/tools/db2xcat /etc/init.d/db2xcat"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed. DB2 will not automatically restart on reboot."); + } else { # added the script to start db2fmcd + $cmd = "chkconfig --add db2xcat"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed. DB2 will not automatically restart on reboot."); + + } + } + } + # add setup required for DB2 reboot + $cmd = " fgrep \"kernel.shmmax = 268435456\" /etc/sysctl.conf"; + xCAT::Utils->runcmd($cmd, -1); # entry not there + if ($::RUNCMD_RC != 0) { + $cmd = "echo \"#xcat setup\" >> /etc/sysctl.conf "; + xCAT::Utils->runcmd($cmd,0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("I", " $cmd failed."); + } + $cmd = "echo \"kernel.shmmax = 268435456\" >> /etc/sysctl.conf "; + xCAT::Utils->runcmd($cmd,0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("I", " $cmd failed. DB2 will not automatically restart on reboot."); + } + } + + } # end Linux + } @@ -1348,6 +1394,14 @@ sub setupODBC { if (!(-e "$::databaseloc/sqllib/lib/libdb2.so")) { + $cmd = "touch db2sql.test"; # see if this is a writable directory + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = "You are not in a writable directory. To run this command change to a directory in which db2sqlsetup can create files."; + xCAT::MsgUtils->message("E", " $cmd failed. $message"); + exit(1); + } $cmd = "ar -x $::databaseloc/sqllib/lib/libdb2.a"; @rpmoutput = xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0)