fix running under daemon

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@724 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2008-03-07 18:30:27 +00:00
parent f121301e82
commit d8debc2158
2 changed files with 30 additions and 22 deletions

View File

@ -5,7 +5,9 @@ package xCAT_plugin::CONSsn;
use xCAT::Table;
use xCAT::Utils;
use xCAT_plugin::conserver;
use xCAT::Client;
use xCAT::MsgUtils;
use Getopt::Long;
@ -36,16 +38,16 @@ sub handled_commands
if (xCAT::Utils->isServiceNode())
{
my @nodeinfo = xCAT::Utils->determinehostname;
my $nodename = pop @nodeinfo; # get hostname
my @nodeipaddr = @nodeinfo; # get ip addresses
my $nodename = pop @nodeinfo; # get hostname
my @nodeipaddr = @nodeinfo; # get ip addresses
my $service = "cons";
my $service = "cons";
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
if ($rc == 1)
{
# service needed on this Service Node
$rc = &setup_CONS($nodename); # setup CONS
$rc = &setup_CONS($nodename); # setup CONS
if ($rc == 0)
{
xCAT::Utils->update_xCATSN($service);
@ -96,13 +98,13 @@ sub setup_CONS
$arch = $retdata->{'arch'};
# make the consever 8 configuration file
$cmd = "makeconservercf";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
{ # error
xCAT::MsgUtils->message("S", "Error running $cmd");
return 1;
}
my $cmdref;
$cmdref->{command}->[0] = "makeconservercf";
$cmdref->{cwd}->[0] = "/opt/xcat/sbin";
my $modname = "conserver";
${"xCAT_plugin::" . $modname . "::"}{process_request}
->($cmdref,\&xCAT::Client::handle_response);
my $cmd = "chkconfig conserver on";
xCAT::Utils->runcmd($cmd, 0);
if ($::RUNCMD_RC != 0)
@ -127,4 +129,5 @@ sub setup_CONS
}
return $rc;
}
1;

View File

@ -5,8 +5,10 @@ package xCAT_plugin::DHCPsn;
use xCAT::Table;
use xCAT::Utils;
use xCAT_plugin::dhcp;
use xCAT::MsgUtils;
use xCAT::Client;
use Getopt::Long;
#-------------------------------------------------------
@ -33,8 +35,8 @@ sub handled_commands
if (xCAT::Utils->isServiceNode())
{
my @nodeinfo = xCAT::Utils->determinehostname;
my $nodename = pop @nodeinfo; # get hostname
my @nodeipaddr = @nodeinfo; # get ip addresses
my $nodename = pop @nodeinfo; # get hostname
my @nodeipaddr = @nodeinfo; # get ip addresses
my $service = "dhcpserver";
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
@ -42,7 +44,7 @@ sub handled_commands
{
# service needed on this Service Node
$rc = &setup_DHCP($nodename); # setup DHCP
$rc = &setup_DHCP($nodename); # setup DHCP
if ($rc == 0)
{
xCAT::Utils->update_xCATSN($service);
@ -97,13 +99,15 @@ sub setup_DHCP
{
$XCATROOT = $ENV{'XCATROOT'};
}
$cmd = "$XCATROOT/sbin/makedhcp -n";
@output = xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message("S", "Error from $cmd, output=@output");
return 1;
}
my $cmdref;
$cmdref->{command}->[0] = "makedhcp";
$cmdref->{cwd}->[0] = "/opt/xcat/sbin";
$cmdref->{arg}->[0] = "-n";
my $modname = "dhcp";
${"xCAT_plugin::" . $modname . "::"}{process_request}
->($cmdref,\&xCAT::Client::handle_response);
$cmd = "chkconfig dhcpd on";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0)
@ -126,4 +130,5 @@ sub setup_DHCP
}
return $rc;
}
1;