start named on boot.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11646 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
sjing 2012-02-21 02:04:35 +00:00
parent 6b2e80c028
commit 99092c60c3
2 changed files with 65 additions and 0 deletions

View File

@ -805,6 +805,35 @@ sub setup_DNS
return 1;
}
# start named on boot
if (xCAT::Utils->isAIX())
{
#/etc/inittab
my $cmd = "/usr/sbin/lsitab named > /dev/null 2>&1";
my $rc = system("$cmd") >>8;
if ($rc != 0)
{
#add new entry
my $mkcmd = qq~/usr/sbin/mkitab "named:2:once:/usr/sbin/named > /dev/console 2>&1"~;
system("$mkcmd");
xCAT::MsgUtils->message("SI", " named has been enabled on boot.");
}
}
else
{
#chkconfig
my $cmd = "/sbin/chkconfig $serv on";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message("SE", " Error: Could not enable $serv.");
}
else
{
xCAT::MsgUtils->message("SI", " $serv has been enabled on boot.");
}
}
return 0;
}

View File

@ -522,6 +522,42 @@ sub process_request {
$ctx->{resolver} = Net::DNS::Resolver->new(nameservers=>['127.0.0.1']); # default to localhost
}
add_or_delete_records($ctx);
# start named on boot
if (xCAT::Utils->isAIX())
{
#/etc/inittab
my $cmd = "/usr/sbin/lsitab named > /dev/null 2>&1";
my $rc = system("$cmd") >>8;
if ($rc != 0)
{
#add new entry
my $mkcmd = qq~/usr/sbin/mkitab "named:2:once:/usr/sbin/named > /dev/console 2>&1"~;
system("$mkcmd");
my $rsp = {};
$rsp->{data}->[0] = "named has been enabled on boot.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
else
{
#chkconfig
my $cmd = "/sbin/chkconfig $service on";
my $outref = xCAT::Utils->runcmd("$cmd", 0);
if ($::RUNCMD_RC != 0)
{
my $rsp = {};
$rsp->{data}->[0] = "Could not enable $service.";
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
}
else
{
my $rsp = {};
$rsp->{data}->[0] = "$service has been enabled on boot.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
xCAT::SvrUtils::sendmsg("DNS setup is completed", $callback);
}