From 99092c60c32612996492f149d022cc45451663b3 Mon Sep 17 00:00:00 2001 From: sjing Date: Tue, 21 Feb 2012 02:04:35 +0000 Subject: [PATCH] start named on boot. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11646 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/AAsn.pm | 29 ++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/ddns.pm | 36 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 7720f7fc7..cec773663 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -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; } diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 6dfab952b..27352243a 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -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); }