From 448b54da49724c2c52b997f5196df6ad9b11a13d Mon Sep 17 00:00:00 2001 From: lissav Date: Thu, 10 Feb 2011 14:18:31 +0000 Subject: [PATCH] put in paths to the appropriate interactive command, did not pick up when running under the daemon git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8815 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/runsqlcmd | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/xCAT-server/sbin/runsqlcmd b/xCAT-server/sbin/runsqlcmd index 502ef46ff..c6d4f7061 100755 --- a/xCAT-server/sbin/runsqlcmd +++ b/xCAT-server/sbin/runsqlcmd @@ -276,16 +276,22 @@ sub runmysqlcmd my ($prefix, $dbname) = split('=', $front); my ($host, $admin, $passwd) = split('\|', $back); my ($hostind, $hostname) = split('=', $host); - + my $rc = 0; if (!(-e $file)) { # file does not exist xCAT::MsgUtils->message("SE", "The file:$file does not exist. "); return; } - + # set correct path to the mysql cmd + my $mysql; + if (xCAT::Utils->isAIX()) { + $mysql="/usr/local/mysql/bin/mysql"; + } else { + $mysql="/usr/bin/mysql"; + } my $cmd = - "mysql --user=$admin --password=$passwd --host=$hostname $dbname \< $file "; + "$mysql --user=$admin --password=$passwd --host=$hostname $dbname \< $file "; #xCAT::MsgUtils->message("SI", "Running mysql --user=$admin --host=$hostname $dbname $file "); system("$cmd"); @@ -324,8 +330,15 @@ sub runpgsqlcmd "The file:$file does not exist. "); return; } + # set correct path to the psql cmd + my $psql; + if (xCAT::Utils->isAIX()) { + $psql="/var/lib/pgsql/bin/psql"; + } else { + $psql="/usr/bin/psql"; + } my $cmd = - "PGPASSWORD=$passwd psql -d $dbname -h $hostname -U $admin -f $file "; + "PGPASSWORD=$passwd $psql -d $dbname -h $hostname -U $admin -f $file "; #xCAT::MsgUtils->message("SI", "Running psql -d $dbname -h $hostname -U $admin -f $file "); system("$cmd");