diff --git a/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm index 67e37d208..e6a4fa08b 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/CONSsn.pm @@ -101,15 +101,6 @@ sub setup_CONS { # error xCAT::MsgUtils->message("S", "Error running $cmd"); } - - # start conserver - my $cmd = "service conserver restart"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - xCAT::MsgUtils->message("S", "Error starting Conserver"); - return 1; - } my $cmd = "chkconfig conserver on"; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) @@ -117,6 +108,15 @@ sub setup_CONS xCAT::MsgUtils->message("S", "Error chkconfig conserver on"); } + # start conserver + my $cmd = "/etc/rc.d/init.d/conserver start"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("S", "Error starting Conserver"); + return 1; + } + } else { # error reading Db diff --git a/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm b/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm index 9d78d9e2c..bbc223936 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/DHCPsn.pm @@ -104,7 +104,14 @@ sub setup_DHCP xCAT::MsgUtils->message("S", "Error from $cmd, output=@output"); return 1; } - $cmd = "service dhcpd restart"; + $cmd = "chkconfig dhcpd on"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("S", "Error from $cmd"); + return 1; + } + $cmd = "/etc/rc.d/init.d/dhcpd start"; xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { diff --git a/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm index 723aba429..c1cf494a3 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/DNSsn.pm @@ -98,79 +98,95 @@ sub setup_DNS $arch = $retdata->{'arch'}; # build the named.conf file - if (($os =~ /rh/i) || ($os =~ /fe/i)) - { - my $namedconfig = "/etc/named.conf"; - my @nameconfigtemplate; - $nameconfigtemplate[0] = "options {directory \"/var/named\";\n"; - $nameconfigtemplate[1] = - " dump-file \"/var/named/data/cache_dump.db\";\n"; - $nameconfigtemplate[2] = - " statistics-file \"/var/named/data/named_stats.txt\";\n"; - $nameconfigtemplate[3] = " forward only;\n"; - $nameconfigtemplate[4] = " forwarders{$master;\n };\n"; - $nameconfigtemplate[5] = "};\n"; - $nameconfigtemplate[6] = "\n"; - $nameconfigtemplate[7] = "controls {\n"; - $nameconfigtemplate[8] = - " inet 127.0.0.1 allow { localhost; } keys { rndckey; };\n"; - $nameconfigtemplate[9] = "};\n"; - $nameconfigtemplate[10] = "\n"; - $nameconfigtemplate[11] = "zone \".\" IN {\n"; - $nameconfigtemplate[12] = " type hint;\n"; - $nameconfigtemplate[13] = " file \"named.ca\";\n"; - $nameconfigtemplate[14] = "};\n\n"; - $nameconfigtemplate[15] = "zone \"localdomain\" IN {\n"; - $nameconfigtemplate[16] = " type master;\n"; - $nameconfigtemplate[17] = " file \"localdomain.zone\";\n"; - $nameconfigtemplate[18] = " allow-update { none; };\n"; - $nameconfigtemplate[19] = "};\n"; - $nameconfigtemplate[20] = "\n"; - $nameconfigtemplate[21] = "zone \"localhost\" IN {\n"; - $nameconfigtemplate[22] = " type master;\n"; - $nameconfigtemplate[23] = " file \"localhost.zone\";\n"; - $nameconfigtemplate[24] = " allow-update { none; };\n"; - $nameconfigtemplate[25] = "};\n"; - $nameconfigtemplate[26] = "\n"; - $nameconfigtemplate[27] = "zone \"0.0.127.in-addr.arpa\" IN {\n"; - $nameconfigtemplate[28] = " type master;\n"; - $nameconfigtemplate[29] = " file \"named.local\";\n"; - $nameconfigtemplate[30] = " allow-update { none; };\n"; - $nameconfigtemplate[31] = "};\n"; - $nameconfigtemplate[32] = "\n"; - $nameconfigtemplate[33] = - "zone \"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa\" IN { \n"; - $nameconfigtemplate[34] = " type master; \n"; - $nameconfigtemplate[35] = " file \"named.ip6.local\";\n"; - $nameconfigtemplate[36] = " allow-update { none; };\n"; - $nameconfigtemplate[37] = "};\n"; - $nameconfigtemplate[38] = "\n"; - $nameconfigtemplate[39] = "zone \"255.in-addr.arpa\" IN {\n "; - $nameconfigtemplate[40] = " type master; \n"; - $nameconfigtemplate[41] = " file \"named.broadcast\";\n"; - $nameconfigtemplate[42] = " allow-update { none; };\n"; - $nameconfigtemplate[43] = "};\n"; - $nameconfigtemplate[44] = "\n"; - $nameconfigtemplate[45] = "zone \"0.in-addr.arpa\" IN {\n "; - $nameconfigtemplate[46] = " type master;\n "; - $nameconfigtemplate[47] = " file \"named.zero\";\n"; - $nameconfigtemplate[48] = " allow-update { none; };\n"; - $nameconfigtemplate[49] = "};\n"; - $nameconfigtemplate[50] = "\n"; - $nameconfigtemplate[51] = "include \"/etc/rndc.key\";\n "; + my $namedconfig = "/etc/named.conf"; + my @nameconfigtemplate; + $nameconfigtemplate[0] = "options {directory \"/var/named\";\n"; + $nameconfigtemplate[1] = + " dump-file \"/var/named/data/cache_dump.db\";\n"; + $nameconfigtemplate[2] = + " statistics-file \"/var/named/data/named_stats.txt\";\n"; + $nameconfigtemplate[3] = " forward only;\n"; + $nameconfigtemplate[4] = " forwarders{$master;\n };\n"; + $nameconfigtemplate[5] = "};\n"; + $nameconfigtemplate[6] = "\n"; + $nameconfigtemplate[7] = "controls {\n"; + $nameconfigtemplate[8] = + " inet 127.0.0.1 allow { localhost; } keys { rndckey; };\n"; + $nameconfigtemplate[9] = "};\n"; + $nameconfigtemplate[10] = "\n"; + $nameconfigtemplate[11] = "zone \".\" IN {\n"; + $nameconfigtemplate[12] = " type hint;\n"; + $nameconfigtemplate[13] = " file \"named.ca\";\n"; + $nameconfigtemplate[14] = "};\n\n"; + $nameconfigtemplate[15] = "zone \"localdomain\" IN {\n"; + $nameconfigtemplate[16] = " type master;\n"; + $nameconfigtemplate[17] = " file \"localdomain.zone\";\n"; + $nameconfigtemplate[18] = " allow-update { none; };\n"; + $nameconfigtemplate[19] = "};\n"; + $nameconfigtemplate[20] = "\n"; + $nameconfigtemplate[21] = "zone \"localhost\" IN {\n"; + $nameconfigtemplate[22] = " type master;\n"; + $nameconfigtemplate[23] = " file \"localhost.zone\";\n"; + $nameconfigtemplate[24] = " allow-update { none; };\n"; + $nameconfigtemplate[25] = "};\n"; + $nameconfigtemplate[26] = "\n"; + $nameconfigtemplate[27] = "zone \"0.0.127.in-addr.arpa\" IN {\n"; + $nameconfigtemplate[28] = " type master;\n"; + $nameconfigtemplate[29] = " file \"named.local\";\n"; + $nameconfigtemplate[30] = " allow-update { none; };\n"; + $nameconfigtemplate[31] = "};\n"; + $nameconfigtemplate[32] = "\n"; + $nameconfigtemplate[33] = + "zone \"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa\" IN { \n"; + $nameconfigtemplate[34] = " type master; \n"; + $nameconfigtemplate[35] = " file \"named.ip6.local\";\n"; + $nameconfigtemplate[36] = " allow-update { none; };\n"; + $nameconfigtemplate[37] = "};\n"; + $nameconfigtemplate[38] = "\n"; + $nameconfigtemplate[39] = "zone \"255.in-addr.arpa\" IN {\n "; + $nameconfigtemplate[40] = " type master; \n"; + $nameconfigtemplate[41] = " file \"named.broadcast\";\n"; + $nameconfigtemplate[42] = " allow-update { none; };\n"; + $nameconfigtemplate[43] = "};\n"; + $nameconfigtemplate[44] = "\n"; + $nameconfigtemplate[45] = "zone \"0.in-addr.arpa\" IN {\n "; + $nameconfigtemplate[46] = " type master;\n "; + $nameconfigtemplate[47] = " file \"named.zero\";\n"; + $nameconfigtemplate[48] = " allow-update { none; };\n"; + $nameconfigtemplate[49] = "};\n"; + $nameconfigtemplate[50] = "\n"; + $nameconfigtemplate[51] = "include \"/etc/rndc.key\";\n "; - open(DNSCFG, ">$namedconfig") - or xCAT::MsgUtils->message('S', + open(DNSCFG, ">$namedconfig") + or xCAT::MsgUtils->message('S', "Cannot open $named.conf for DNS setup \n"); - print DNSCFG @nameconfigtemplate; - close DNSCFG; + print DNSCFG @nameconfigtemplate; + close DNSCFG; - # turn DNS on + # turn DNS on - `cp /etc/named.conf /var/named/chroot/etc`; - `chkconfig --level 345 named on`; - `service named restart`; + $cmd = "cp /etc/named.conf /var/named/chroot/etc"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("S", "Error from $cmd"); + return 1; } + $cmd = "chkconfig named on"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("S", "Error from $cmd"); + return 1; + } + $cmd = "/etc/rc.d/init.d/named restart"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("S", "Error from $cmd"); + return 1; + } + } else { # error reading DB diff --git a/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm b/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm index c28b75182..06162ef1a 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/NFSsn.pm @@ -145,20 +145,20 @@ sub setup_NFS xCAT::MsgUtils->message("S", "Error exporting $tftpdir"); } } - - # make sure nfs is started - my $cmd = "service nfs restart"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { # error - xCAT::MsgUtils->message("S", "Error starting NFS"); - return 1; - } my $cmd = "chkconfig nfs on"; xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { # error - xCAT::MsgUtils->message("S", "Error chkconfig nfs on"); + xCAT::MsgUtils->message("S", "Error on command:$cmd"); + } + + # make sure nfs is started + my $cmd = "/etc/rc.d/init.d/nfs restart"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { # error + xCAT::MsgUtils->message("S", "Error on command: $cmd"); + return 1; } # export the directories diff --git a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm index fdaebe55e..60c1d131c 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm @@ -117,7 +117,7 @@ sub setup_TFTP xCAT::MsgUtils->message("S", "Error running $cmd"); return 1; } - my $cmd = "service xinetd restart"; + my $cmd = "/etc/rc.d/init.d/xinetd restart"; xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) {