Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8
This commit is contained in:
commit
966e66e9e3
@ -1850,7 +1850,9 @@ sub get_image_name
|
||||
Example:
|
||||
if (xCAT::Utils->startService("named") { ...}
|
||||
Comments:
|
||||
none
|
||||
this subroutine is deprecated,
|
||||
will be used as an internal function to process AIX service,
|
||||
for linux, use xCAT::Utils->startservice instead
|
||||
|
||||
=cut
|
||||
|
||||
@ -3557,7 +3559,7 @@ sub servicemap{
|
||||
# }
|
||||
my %svchash=(
|
||||
"dhcp" => {
|
||||
0=>["dhcpd","isc-dhcp-server"],
|
||||
0=>["dhcp3-server","dhcpd","isc-dhcp-server"],
|
||||
1=>["dhcpd.service"],
|
||||
},
|
||||
"nfs" => {
|
||||
|
@ -10,12 +10,17 @@
|
||||
checks for errors.
|
||||
=cut
|
||||
#------------------------------------------------------------------------------#
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
use strict;
|
||||
use locale;
|
||||
use Getopt::Long;
|
||||
use IPC::SysV qw(IPC_STAT S_IRWXU IPC_PRIVATE IPC_CREAT S_IRUSR S_IWUSR );
|
||||
use IPC::Msg;
|
||||
use xCAT::Utils;
|
||||
|
||||
BEGIN
|
||||
{
|
||||
@ -109,8 +114,9 @@ if (&first_time_run)
|
||||
runcmd("/usr/bin/mkfifo $fifo");
|
||||
}
|
||||
runcmd("echo \"$embedinfo\" >> $syslogconf");
|
||||
my $cmd = service("syslog", "restart");
|
||||
runcmd($cmd);
|
||||
#my $cmd = service("syslog", "restart");
|
||||
#runcmd($cmd);
|
||||
xCAT::Utils->restartservice("syslog");
|
||||
}
|
||||
touchFile($runfile);
|
||||
}
|
||||
@ -512,6 +518,9 @@ sub createRandomName
|
||||
'stop' or 'status'.
|
||||
Returns:
|
||||
A full cli for the service script.
|
||||
Comment:
|
||||
this subroutine is deprecated, use service subroutines in xCAT::Utils
|
||||
instead
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
@ -154,166 +154,153 @@ sub subvars {
|
||||
#do *all* includes, recursive and all
|
||||
my $doneincludes=0;
|
||||
while (not $doneincludes) {
|
||||
$doneincludes=1;
|
||||
if ($inc =~ /#INCLUDE_PKGLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
|
||||
}
|
||||
}
|
||||
|
||||
#support multiple paths of osimage in rh/sles diskfull installation
|
||||
my @pkgdirs;
|
||||
if ( defined($media_dir) ) {
|
||||
@pkgdirs = split(",", $media_dir);
|
||||
my $source;
|
||||
my $source_in_pre;
|
||||
my $c = 0;
|
||||
foreach my $pkgdir(@pkgdirs) {
|
||||
if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
|
||||
if ( $c == 0 ) {
|
||||
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
|
||||
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
|
||||
$source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
|
||||
$source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
|
||||
} else {
|
||||
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
|
||||
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
|
||||
#support multiple paths of osimage in rh/sles diskfull installation
|
||||
my @pkgdirs;
|
||||
if ( defined($media_dir) ) {
|
||||
@pkgdirs = split(",", $media_dir);
|
||||
my $source;
|
||||
my $source_in_pre;
|
||||
my $c = 0;
|
||||
foreach my $pkgdir(@pkgdirs) {
|
||||
if( $platform =~ /^(rh|SL|centos|fedora)$/ ) {
|
||||
if ( $c == 0 ) {
|
||||
# After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x
|
||||
# the rhels5.9 will not be installed successfully. So put in kickstart directly.
|
||||
$source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos";
|
||||
$source .= "url --url http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #For rhels5.9
|
||||
} else {
|
||||
$source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos";
|
||||
$source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9
|
||||
}
|
||||
} elsif ($platform =~ /^(sles|suse)/) {
|
||||
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
|
||||
$source .= " <listentry>
|
||||
<media_url>$http</media_url>
|
||||
<product>SuSE-Linux-pkg$c</product>
|
||||
<product_dir>/</product_dir>
|
||||
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
|
||||
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
|
||||
</listentry>";
|
||||
$source_in_pre .="<listentry><media_url>http://'\$nextserver'$pkgdir</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
|
||||
$inc =~ s/#INSTALL_SOURCES#/$source/g;
|
||||
$inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
|
||||
}
|
||||
|
||||
#ok, now do everything else..
|
||||
my $shortname = $node;
|
||||
$shortname =~ s/\..*//;
|
||||
$inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
|
||||
$inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
|
||||
$inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
|
||||
$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
|
||||
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
|
||||
$inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
|
||||
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
|
||||
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
|
||||
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
|
||||
$inc =~ s/#YAST2NET#/yast2network()/eg;
|
||||
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
|
||||
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
|
||||
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
|
||||
$inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
|
||||
$inc =~ s/#WINADJOIN#/windows_join_data()/eg;
|
||||
$inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
|
||||
$inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
|
||||
$inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
|
||||
$inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
|
||||
$inc =~ s/#HOSTNAME#/$node/g;
|
||||
$inc =~ s/#SHORTNAME#/$shortname/g;
|
||||
$inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
|
||||
|
||||
my $nrtab = xCAT::Table->new("noderes");
|
||||
my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
|
||||
my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
|
||||
|
||||
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
|
||||
|
||||
#if user specify the partion file, replace the default partition strategy
|
||||
if ($partitionfile){
|
||||
#if the content of the partition file is definition replace the default is ok
|
||||
my $partcontent = '';
|
||||
my $scriptflag = 0;
|
||||
|
||||
if ($partitionfile =~ /^s:(.*)/){
|
||||
$scriptflag = 1;
|
||||
$partitionfile = $1;
|
||||
}
|
||||
|
||||
if (-r $partitionfile){
|
||||
open ($inh, "<", $partitionfile);
|
||||
while (<$inh>){
|
||||
$partcontent .= $_;
|
||||
}
|
||||
close ($inh);
|
||||
|
||||
#the content of the specified file is a script which can write partition definition into /tmp/partitionfile
|
||||
if ($scriptflag){
|
||||
#for redhat/sl/centos/kvm/fedora
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/) {
|
||||
my $tempstr = "%include /tmp/partitionfile\n";
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
|
||||
#modify the content in the file, and write into %pre part
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
#replace the #XCA_PARTITION_SCRIPT#
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
}
|
||||
#for sles/suse
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$partcontent =~ s/\s$//;
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/){
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
|
||||
}
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$partcontent/;
|
||||
}
|
||||
}
|
||||
} elsif ($platform =~ /^(sles|suse)/) {
|
||||
my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir";
|
||||
$source .= " <listentry>
|
||||
<media_url>$http</media_url>
|
||||
<product>SuSE-Linux-pkg$c</product>
|
||||
<product_dir>/</product_dir>
|
||||
<ask_on_error config:type=\"boolean\">false</ask_on_error> <!-- available since openSUSE 11.0 -->
|
||||
<name>SuSE-Linux-pkg$c</name> <!-- available since openSUSE 11.1/SLES11 (bnc#433981) -->
|
||||
</listentry>";
|
||||
$source_in_pre .="<listentry><media_url>http://'\$nextserver'$pkgdir</media_url><product>SuSE-Linux-pkg$c</product><product_dir>/</product_dir><ask_on_error config:type=\"boolean\">false</ask_on_error><name>SuSE-Linux-pkg$c</name></listentry>";
|
||||
}
|
||||
$c++;
|
||||
}
|
||||
|
||||
$inc =~ s/#INSTALL_SOURCES#/$source/g;
|
||||
$inc =~ s/#INSTALL_SOURCES_IN_PRE#/$source_in_pre/g;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#Support hierarchical include
|
||||
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
|
||||
if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
|
||||
}
|
||||
|
||||
#ok, now do everything else..
|
||||
my $shortname = $node;
|
||||
$shortname =~ s/\..*//;
|
||||
$inc =~ s/#TABLE:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3)/eg;
|
||||
$inc =~ s/#TABLEBLANKOKAY:([^:]+):([^:]+):([^#]+)#/tabdb($1,$2,$3,'1')/eg;
|
||||
$inc =~ s/#INCLUDE_NOP:([^#^\n]+)#/includefile($1,1,0)/eg;
|
||||
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1,0,1)/eg;
|
||||
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1,0,2)/eg;
|
||||
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1,0,3)/eg;
|
||||
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
|
||||
$inc =~ s/#XCATVAR:([^#]+)#/envvar($1)/eg;
|
||||
$inc =~ s/#ENV:([^#]+)#/envvar($1)/eg;
|
||||
$inc =~ s/#MACHINEPASSWORD#/machinepassword()/eg;
|
||||
$inc =~ s/#CRYPT:([^:]+):([^:]+):([^#]+)#/crydb($1,$2,$3)/eg;
|
||||
$inc =~ s/#COMMAND:([^#]+)#/command($1)/eg;
|
||||
$inc =~ s/#KICKSTARTNET#/kickstartnetwork()/eg;
|
||||
$inc =~ s/#YAST2NET#/yast2network()/eg;
|
||||
$inc =~ s/#ESXIPV6SETUP#/esxipv6setup()/eg;
|
||||
$inc =~ s/#WINTIMEZONE#/xCAT::TZUtils::get_wintimezone()/eg;
|
||||
$inc =~ s/#WINPRODKEY:([^#]+)#/get_win_prodkey($1)/eg;
|
||||
$inc =~ s/#WINNETCFG#/windows_net_cfg()/eg;
|
||||
$inc =~ s/#WINADJOIN#/windows_join_data()/eg;
|
||||
$inc =~ s/#WINDNSCFG#/windows_dns_cfg()/eg;
|
||||
$inc =~ s/#WINACCOUNTDATA#/windows_account_data()/eg;
|
||||
$inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg;
|
||||
$inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg;
|
||||
$inc =~ s/#HOSTNAME#/$node/g;
|
||||
$inc =~ s/#SHORTNAME#/$shortname/g;
|
||||
$inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
|
||||
|
||||
my $nrtab = xCAT::Table->new("noderes");
|
||||
my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
|
||||
my $sles_sdk_media = "http://" . $tftpserver->{tftpserver} . $media_dir . "/sdk1";
|
||||
|
||||
$inc =~ s/#SLES_SDK_MEDIA#/$sles_sdk_media/eg;
|
||||
|
||||
#if user specify the partion file, replace the default partition strategy
|
||||
if ($partitionfile){
|
||||
#if the content of the partition file is definition replace the default is ok
|
||||
my $partcontent = '';
|
||||
my $scriptflag = 0;
|
||||
|
||||
if ($partitionfile =~ /^s:(.*)/){
|
||||
$scriptflag = 1;
|
||||
$partitionfile = $1;
|
||||
}
|
||||
|
||||
if (-r $partitionfile){
|
||||
open ($inh, "<", $partitionfile);
|
||||
while (<$inh>){
|
||||
$partcontent .= $_;
|
||||
}
|
||||
close ($inh);
|
||||
|
||||
#the content of the specified file is a script which can write partition definition into /tmp/partitionfile
|
||||
if ($scriptflag){
|
||||
#for redhat/sl/centos/kvm/fedora
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/) {
|
||||
my $tempstr = "%include /tmp/partitionfile\n";
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
|
||||
#modify the content in the file, and write into %pre part
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
#replace the #XCA_PARTITION_SCRIPT#
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
}
|
||||
#for sles/suse
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
my $tempstr = "<drive><device>XCATPARTITIONTEMP</device></drive>";
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$tempstr/;
|
||||
#$partcontent = "cat > /tmp/partscript << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent = "echo " . "'". $partcontent . "'" . ">/tmp/partscript\n";
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
$partcontent .= "/tmp/partscript\n";
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$partcontent =~ s/\s$//;
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/){
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
|
||||
}
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$partcontent/;
|
||||
}
|
||||
}
|
||||
}
|
||||
$doneincludes=1;
|
||||
if ($inc =~ /#INCLUDE_PKGLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_PKGLIST:([^#^\n]+)#/includefile($1, 0, 1)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE_PTRNLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_PTRNLIST:([^#^\n]+)#/includefile($1, 0, 2)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE_RMPKGLIST:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE_RMPKGLIST:([^#^\n]+)#/includefile($1, 0, 3)/eg;
|
||||
}
|
||||
if ($inc =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$inc =~ s/#INCLUDE:([^#^\n]+)#/includefile($1, 0, 0)/eg;
|
||||
}
|
||||
}
|
||||
|
||||
if ($tmplerr) {
|
||||
close ($outh);
|
||||
return $tmplerr;
|
||||
}
|
||||
close ($outh);
|
||||
return $tmplerr;
|
||||
}
|
||||
print $outh $inc;
|
||||
close($outh);
|
||||
return 0;
|
||||
|
@ -66,12 +66,14 @@ sub start {
|
||||
my $mychildren_cfg="/etc/nagios/objects/mychildren.cfg";
|
||||
if ($isSN) { #start nagios daemon only when mychildren exists on the sn
|
||||
if (-f $mychildren_cfg) {
|
||||
my $rc=`service nagios restart 2>&1`;
|
||||
#my $rc=`service nagios restart 2>&1`;
|
||||
my $rc=xCAT::Utils->restartservice("nagios");
|
||||
reportError("$localhostname: $rc", $callback);
|
||||
}
|
||||
}
|
||||
else { #always start nagios daemon on mn
|
||||
my $rc=`service nagios restart 2>&1`;
|
||||
#my $rc=`service nagios restart 2>&1`;
|
||||
my $rc=xCAT::Utils->restartservice("nagios");
|
||||
reportError("$localhostname: $rc", $callback);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,8 @@ sub start_RRD_server
|
||||
print FILE "\tserver_args = - /var/rrd\n";
|
||||
print FILE "}\n";
|
||||
close FILE;
|
||||
xCAT::Utils->runcmd("service xinetd restart", 0);
|
||||
#xCAT::Utils->runcmd("service xinetd restart", 0);
|
||||
xCAT::Utils->restartservice("xinetd");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -188,7 +189,8 @@ sub stop_RRD_server
|
||||
} else {
|
||||
xCAT::Utils->runcmd("rm -f /etc/xinetd.d/rrdsrv", 0);
|
||||
}
|
||||
xCAT::Utils->runcmd("service xinetd restart", 0);
|
||||
#xCAT::Utils->runcmd("service xinetd restart", 0);
|
||||
xCAT::Utils->restartservice("xinetd");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -509,8 +509,13 @@ sub setup_CONS
|
||||
"conserver cannot be started because the file $ca_file2 cannot be found\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
my $rc = xCAT::Utils->startService("conserver");
|
||||
{
|
||||
if (xCAT::Utils->isAIX()){
|
||||
$rc=xCAT::Utils->startService("conserver");
|
||||
}elsif(xCAT::Utils->isLinux()){
|
||||
#my $rc = xCAT::Utils->startService("conserver");
|
||||
$rc=xCAT::Utils->startservice("conserver");
|
||||
}
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -537,9 +542,11 @@ sub setup_DHCP
|
||||
my $snonly = 0;
|
||||
# if on the MN check to see if dhcpd is running, and start it if not.
|
||||
if (xCAT::Utils->isMN()) { # on the MN
|
||||
my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
$rc = xCAT::Utils->startService("dhcpd");
|
||||
#my @output = xCAT::Utils->runcmd("service dhcpd status", -1);
|
||||
#if ($::RUNCMD_RC != 0) { # not running
|
||||
my $retcode= xCAT::Utils->checkservicestatus("dhcpd");
|
||||
if($retcode!=0){
|
||||
$rc = xCAT::Utils->startservice("dhcpd");
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -573,12 +580,18 @@ sub setup_DHCP
|
||||
->($cmdref, \&xCAT::Client::handle_response);
|
||||
|
||||
my $distro = xCAT::Utils->osver();
|
||||
my $serv = "dhcpd";
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
$serv = "isc-dhcp-server";
|
||||
}
|
||||
#my $serv = "dhcpd";
|
||||
#if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
# $serv = "isc-dhcp-server";
|
||||
#}
|
||||
|
||||
my $rc = xCAT::Utils->startService($serv);
|
||||
#my $rc = xCAT::Utils->startService($serv);
|
||||
my $rc=0;
|
||||
if(xCAT::Utils->isAIX()){
|
||||
$rc = xCAT::Utils->startService("dhcpd");
|
||||
} elsif(xCAT::Utils->isLinux()){
|
||||
$rc = xCAT::Utils->startservice("dhcp");
|
||||
}
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -672,7 +685,13 @@ sub setup_FTP
|
||||
|
||||
# start ftp
|
||||
|
||||
my $rc = xCAT::Utils->startService("vsftpd");
|
||||
#my $rc = xCAT::Utils->startService("vsftpd");
|
||||
my $rc = 0;
|
||||
if(xCAT::Utils->isAIX()){
|
||||
$rc = xCAT::Utils->startService("vsftpd");
|
||||
}elsif(xCAT::Utils->isLinux()){
|
||||
$rc = xCAT::Utils->startservice("vsftpd");
|
||||
}
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -723,12 +742,19 @@ sub setup_DNS
|
||||
# turn DNS on
|
||||
|
||||
my $distro = xCAT::Utils->osver();
|
||||
my $serv = "named";
|
||||
if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
$serv = "bind9";
|
||||
#my $serv = "named";
|
||||
#if ( $distro =~ /ubuntu.*/i || $distro =~ /debian.*/i ){
|
||||
# $serv = "bind9";
|
||||
#}
|
||||
|
||||
#my $rc = xCAT::Utils->startService($serv);
|
||||
my $rc = 0;
|
||||
if(xCAT::Utils->isAIX()){
|
||||
$rc = xCAT::Utils->startService("named");
|
||||
}elsif(xCAT::Utils->isLinux()){
|
||||
$rc=xCAT::Utils->startservice("named");
|
||||
}
|
||||
|
||||
my $rc = xCAT::Utils->startService($serv);
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -751,15 +777,17 @@ sub setup_DNS
|
||||
else
|
||||
{
|
||||
#chkconfig
|
||||
my $cmd = "/sbin/chkconfig $serv on";
|
||||
my $outref = xCAT::Utils->runcmd("$cmd", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
#my $cmd = "/sbin/chkconfig $serv on";
|
||||
#my $outref = xCAT::Utils->runcmd("$cmd", 0);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
my $retcode=xCAT::Utils->enableservice("named");
|
||||
if($retcode!=0)
|
||||
{
|
||||
xCAT::MsgUtils->message("SE", " Error: Could not enable $serv.");
|
||||
xCAT::MsgUtils->message("SE", " Error: Could not enable dns server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
xCAT::MsgUtils->message("SI", " $serv has been enabled on boot.");
|
||||
xCAT::MsgUtils->message("SI", " dns server has been enabled on boot.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -778,7 +806,14 @@ sub setup_DNS
|
||||
sub setup_LDAP
|
||||
{
|
||||
|
||||
my $rc = xCAT::Utils->startService("ldap");
|
||||
#my $rc = xCAT::Utils->startService("ldap");
|
||||
my $rc = 0;
|
||||
|
||||
if(xCAT::Utils->isAIX()){
|
||||
$rc = xCAT::Utils->startService("ldap");
|
||||
}elsif(xCAT::Utils->isLinux()){
|
||||
$rc=xCAT::Utils->startservice("ldap");
|
||||
}
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -805,16 +840,17 @@ sub setup_NFS
|
||||
my $rc = 0;
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
my $os = xCAT::Utils->osver();
|
||||
if ($os =~ /sles.*/)
|
||||
{
|
||||
$rc = xCAT::Utils->startService("nfs");
|
||||
$rc = xCAT::Utils->startService("nfsserver");
|
||||
}
|
||||
else
|
||||
{
|
||||
$rc = xCAT::Utils->startService("nfs");
|
||||
}
|
||||
#my $os = xCAT::Utils->osver();
|
||||
#if ($os =~ /sles.*/)
|
||||
#{
|
||||
# $rc = xCAT::Utils->startService("nfs");
|
||||
# $rc = xCAT::Utils->startService("nfsserver");
|
||||
#}
|
||||
#else
|
||||
#{
|
||||
# $rc = xCAT::Utils->startService("nfs");
|
||||
#}
|
||||
$rc = xCAT::Utils->startservice("nfs");
|
||||
}
|
||||
else
|
||||
{ #AIX
|
||||
@ -944,7 +980,14 @@ sub setup_NTPmn
|
||||
sub start_NTP
|
||||
{
|
||||
|
||||
my $rc = xCAT::Utils->startService("ntpd");
|
||||
my $rc =0;
|
||||
if (xCAT::Utils->isAIX()){
|
||||
$rc=xCAT::Utils->startService("ntpd");
|
||||
}elsif(xCAT::Utils->isLinux()){
|
||||
#my $rc = xCAT::Utils->startService("conserver");
|
||||
$rc=xCAT::Utils->startservice("ntpd");
|
||||
}
|
||||
|
||||
if ($rc != 0)
|
||||
{
|
||||
return 1;
|
||||
@ -1271,15 +1314,16 @@ sub setup_HTTP
|
||||
|
||||
if (xCAT::Utils->isLinux())
|
||||
{
|
||||
my $os = xCAT::Utils->osver();
|
||||
if ($os =~ /sles.*/)
|
||||
{
|
||||
$rc = xCAT::Utils->startService("apache2");
|
||||
}
|
||||
else
|
||||
{
|
||||
$rc = xCAT::Utils->startService("httpd");
|
||||
}
|
||||
#my $os = xCAT::Utils->osver();
|
||||
#if ($os =~ /sles.*/)
|
||||
#{
|
||||
# $rc = xCAT::Utils->startService("apache2");
|
||||
#}
|
||||
#else
|
||||
#{
|
||||
# $rc = xCAT::Utils->startService("httpd");
|
||||
#}
|
||||
$rc=xCAT::Utils->startservice("http");
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
@ -1385,24 +1429,33 @@ sub enable_TFTPhpa
|
||||
}
|
||||
print FILE @newcfgfile;
|
||||
close (FILE);
|
||||
my @output = xCAT::Utils->runcmd("service xinetd status", -1);
|
||||
if ($::RUNCMD_RC == 0) {
|
||||
if (grep(/running/, @output))
|
||||
{
|
||||
print ' '; # indent service output to separate it from the xcatd service output
|
||||
system "service xinetd stop";
|
||||
if ($? > 0)
|
||||
{ # error
|
||||
#my @output = xCAT::Utils->runcmd("service xinetd status", -1);
|
||||
#if ($::RUNCMD_RC == 0) {}
|
||||
my $retcode=xCAT::Utils->checkservicestatus("xinetd");
|
||||
if($retcode==0){
|
||||
my $retcode=xCAT::Utils->restartservice("xinetd");
|
||||
if($retcode !=0 )
|
||||
{
|
||||
xCAT::MsgUtils->message("S",
|
||||
"Error on command: service xinetd stop\n");
|
||||
"Error on restart xinetd\n");
|
||||
|
||||
}
|
||||
system "service xinetd start";
|
||||
if ($? > 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S",
|
||||
"Error on command: service xinetd start\n");
|
||||
}
|
||||
}
|
||||
#if (grep(/running/, @output))
|
||||
#{
|
||||
# print ' '; # indent service output to separate it from the xcatd service output
|
||||
# system "service xinetd stop";
|
||||
# if ($? > 0)
|
||||
# { # error
|
||||
# xCAT::MsgUtils->message("S",
|
||||
# "Error on command: service xinetd stop\n");
|
||||
# }
|
||||
# system "service xinetd start";
|
||||
# if ($? > 0)
|
||||
# { # error
|
||||
# xCAT::MsgUtils->message("S",
|
||||
# "Error on command: service xinetd start\n");
|
||||
# }
|
||||
#}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1449,7 +1502,8 @@ sub enable_TFTPhpa
|
||||
sleep 1;
|
||||
my @checkproc=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
if (@checkproc){
|
||||
system("service tftpd-hpa stop");
|
||||
#system("service tftpd-hpa stop");
|
||||
xCAT::Utils->stopservice("tftpd-hpa");
|
||||
}
|
||||
}
|
||||
my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`;
|
||||
|
@ -1978,20 +1978,51 @@ sub mksysclone
|
||||
}
|
||||
|
||||
my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile};
|
||||
my $out = xCAT::Utils->runcmd($cmd, -1);
|
||||
my $rc = xCAT::Utils->runcmd($cmd, -1);
|
||||
|
||||
my $imagedir;
|
||||
my $osimagetab = xCAT::Table->new('linuximage');
|
||||
my $osimageentry = $osimagetab->getAttribs({imagename => $imagename}, 'rootimgdir');
|
||||
if($osimageentry){
|
||||
$imagedir = $osimageentry->{rootimgdir};
|
||||
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
|
||||
}else{
|
||||
$imagedir = "$installroot/sysclone/images";
|
||||
$cmd = "chdef -t osimage $imagename rootimgdir=$imagedir/$imagename";
|
||||
$rc = `$cmd`;
|
||||
}
|
||||
|
||||
my $cfgimagedir = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
|
||||
chomp($cfgimagedir);
|
||||
$cfgimagedir =~ s/^\s+path=(\/.*)\/.+$/$1/g;
|
||||
|
||||
if($imagedir ne $cfgimagedir){
|
||||
my $oldstr = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
|
||||
chomp($oldstr);
|
||||
$oldstr =~ s/\//\\\\\//g;
|
||||
|
||||
unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
|
||||
my $targetstr="\tpath=".$imagedir."/".$imagename;
|
||||
$targetstr =~ s/\//\\\\\//g;
|
||||
$cmd= "sed -i \"s/$oldstr/$targetstr/\" /etc/systemimager/rsync_stubs/40$imagename";
|
||||
$rc = `$cmd`;
|
||||
}
|
||||
|
||||
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
|
||||
|
||||
unless (-r "$imagedir/$imagename/opt/xcat/xcatdsklspost")
|
||||
{
|
||||
mkpath("$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
mkpath("$imagedir/$imagename/opt/xcat/");
|
||||
copy("$installroot/postscripts/xcatdsklspost","$imagedir/$imagename/opt/xcat/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# check systemimager-server-rsyncd to make sure it's running.
|
||||
my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
my $rc = xCAT::Utils->startService("systemimager-server-rsyncd");
|
||||
#my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
|
||||
# if ($::RUNCMD_RC != 0) { # not running
|
||||
my $retcode=xCAT::Utils->checkservicestatus("systemimager-server-rsyncd");
|
||||
if($retcode!=0){
|
||||
my $rc = xCAT::Utils->startservice("systemimager-server-rsyncd");
|
||||
if ($rc != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -571,7 +571,8 @@ sub process_request {
|
||||
}
|
||||
else
|
||||
{
|
||||
system("service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
#system("service $service stop"); #named may otherwise hold on to stale journal filehandles
|
||||
xCAT::Utils->stopservice("named");
|
||||
}
|
||||
my $conf = get_conf();
|
||||
unlink $conf;
|
||||
@ -614,24 +615,31 @@ sub process_request {
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service $service stop";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
#my $cmd = "service $service stop";
|
||||
#my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
#my $outp = join('', @output);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
#{
|
||||
# my $rsp = {};
|
||||
# $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# return;
|
||||
#}
|
||||
|
||||
$cmd = "service $service start";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
$outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
#$cmd = "service $service start";
|
||||
#@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
#$outp = join('', @output);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
#{
|
||||
# my $rsp = {};
|
||||
# $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# return;
|
||||
#}
|
||||
my $retcode=xCAT::Utils->restartservice("named");
|
||||
if($retcode!=0){
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
$rsp->{data}->[0] = "failed to start named.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
@ -673,20 +681,29 @@ sub process_request {
|
||||
}
|
||||
else
|
||||
{
|
||||
my $cmd = "service $service status|grep running";
|
||||
my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
#my $cmd = "service $service status|grep running";
|
||||
#my @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
#if ($::RUNCMD_RC != 0)
|
||||
#{
|
||||
# $cmd = "service $service start";
|
||||
# @output=xCAT::Utils->runcmd($cmd, 0);
|
||||
# my $outp = join('', @output);
|
||||
# if ($::RUNCMD_RC != 0)
|
||||
# {
|
||||
# my $rsp = {};
|
||||
# $rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
# xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# return;
|
||||
# }
|
||||
#}
|
||||
my $retcode=xCAT::Utils->startservice("named");
|
||||
if($retcode!=0)
|
||||
{
|
||||
$cmd = "service $service start";
|
||||
@output=xCAT::Utils->runcmd($cmd, 0);
|
||||
my $outp = join('', @output);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Command failed: $cmd. Error message: $outp.\n";
|
||||
$rsp->{data}->[0] = "failed to start named.\n";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -884,15 +884,19 @@ sub check_options
|
||||
# if not help and not -n, dhcpd needs to be running
|
||||
if (!($opt->{h})&& (!($opt->{n}))) {
|
||||
if (xCAT::Utils->isLinux()) {
|
||||
my $DHCPSERVER="dhcpd";
|
||||
if( -e "/etc/init.d/isc-dhcp-server" ){
|
||||
$DHCPSERVER="isc-dhcp-server";
|
||||
}
|
||||
#my $DHCPSERVER="dhcpd";
|
||||
#if( -e "/etc/init.d/isc-dhcp-server" ){
|
||||
# $DHCPSERVER="isc-dhcp-server";
|
||||
#}
|
||||
|
||||
my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
#my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
|
||||
#if ($::RUNCMD_RC != 0) { # not running
|
||||
my $ret=0;
|
||||
$ret=xCAT::Utils->checkservicestatus("dhcp");
|
||||
if($ret!=0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "$DHCPSERVER is not running. Run service $DHCPSERVER start and rerun your command.";
|
||||
$rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
return 1;
|
||||
}
|
||||
@ -1840,25 +1844,29 @@ sub process_request
|
||||
{
|
||||
restart_dhcpd_aix();
|
||||
}
|
||||
elsif ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i)
|
||||
{
|
||||
if (-e '/etc/dhcp/dhcpd.conf') {
|
||||
system("chmod a+r /etc/dhcp/dhcpd.conf");
|
||||
system("/etc/init.d/isc-dhcp-server restart");
|
||||
}
|
||||
else {
|
||||
#ubuntu config
|
||||
system("chmod a+r /etc/dhcp3/dhcpd.conf");
|
||||
system("/etc/init.d/dhcp3-server restart");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
system("/etc/init.d/dhcpd restart");
|
||||
# should not chkconfig dhcpd on every makedhcp invoation
|
||||
# it is not appropriate and will cause problem for HAMN
|
||||
# do it in xcatconfig instead
|
||||
#system("chkconfig dhcpd on");
|
||||
else {
|
||||
if ( $distro =~ /ubuntu.*/ || $distro =~ /debian.*/i)
|
||||
{
|
||||
if (-e '/etc/dhcp/dhcpd.conf') {
|
||||
system("chmod a+r /etc/dhcp/dhcpd.conf");
|
||||
#system("/etc/init.d/isc-dhcp-server restart");
|
||||
}
|
||||
else {
|
||||
#ubuntu config
|
||||
system("chmod a+r /etc/dhcp3/dhcpd.conf");
|
||||
#system("/etc/init.d/dhcp3-server restart");
|
||||
}
|
||||
}
|
||||
#else
|
||||
#{
|
||||
# system("/etc/init.d/dhcpd restart");
|
||||
# # should not chkconfig dhcpd on every makedhcp invoation
|
||||
# # it is not appropriate and will cause problem for HAMN
|
||||
# # do it in xcatconfig instead
|
||||
# #system("chkconfig dhcpd on");
|
||||
#}
|
||||
xCAT::Utils->restartservice("dhcp");
|
||||
print "xx";
|
||||
}
|
||||
}
|
||||
flock($dhcplockfd,LOCK_UN);
|
||||
|
@ -130,7 +130,7 @@ sub process_request {
|
||||
my $shortname = xCAT::InstUtils->myxCATname();
|
||||
|
||||
my $rc;
|
||||
$rc = sysclone_configserver($shortname, $callback, $doreq);
|
||||
$rc = sysclone_configserver($shortname, $osimg, $callback, $doreq);
|
||||
if($rc){
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = qq{Can not configure Imager Server on $shortname.};
|
||||
@ -467,7 +467,7 @@ sub getplatform {
|
||||
}
|
||||
|
||||
sub sysclone_configserver{
|
||||
my ($server, $callback, $subreq) = @_;
|
||||
my ($server, $osimage, $callback, $subreq) = @_;
|
||||
|
||||
# check if systemimager is installed on the imager server
|
||||
my $rsp = {};
|
||||
@ -514,9 +514,40 @@ sub sysclone_configserver{
|
||||
{
|
||||
mkpath($sysclone_overrides);
|
||||
}
|
||||
|
||||
my $imagedir;
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
|
||||
if(!$entry){
|
||||
$imagedir = $sysclone_home . "/images/" . $osimage;
|
||||
}else{
|
||||
my $osimagetab = xCAT::Table->new('linuximage');
|
||||
my $osimageentry = $osimagetab->getAttribs({imagename => $osimage}, 'rootimgdir');
|
||||
if($osimageentry){
|
||||
$imagedir = $osimageentry->{rootimgdir};
|
||||
if (!(-e $imagedir)){
|
||||
mkpath($imagedir);
|
||||
}
|
||||
}else{
|
||||
$imagedir = $sysclone_home . "/images/" . $osimage;
|
||||
$cmd = "chdef -t osimage $osimage rootimgdir=$imagedir";
|
||||
$rc = `$cmd`;
|
||||
}
|
||||
}
|
||||
|
||||
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
|
||||
$imagedir =~ s/\//\\\\\//g;
|
||||
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
|
||||
|
||||
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
|
||||
$olddir =~ s/\//\\\\\//g;
|
||||
chomp($olddir);
|
||||
|
||||
$cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
|
||||
$rc = `$cmd`;
|
||||
|
||||
# update /etc/systemimager/rsync_stubs/10header to generate new /etc/systemimager/rsyncd.conf
|
||||
my $rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
|
||||
$rc = `sed -i "s/\\/var\\/lib\\/systemimager/\\/install\\/sysclone/g" /etc/systemimager/rsync_stubs/10header`;
|
||||
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
|
||||
|
||||
return 0;
|
||||
@ -678,6 +709,22 @@ sub sysclone_createosimgdef{
|
||||
$osimgdef{$osimage}{template} = "";
|
||||
$osimgdef{$osimage}{otherpkglist} = "";
|
||||
$osimgdef{$osimage}{pkglist} = "";
|
||||
|
||||
if(!($imagedef{$oldimg}{rootimgdir})){
|
||||
$imagedef{$oldimg}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
|
||||
|
||||
my $imagedir = $imagedef{$oldimg}{rootimgdir};
|
||||
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
|
||||
$imagedir =~ s/\//\\\\\//g;
|
||||
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
|
||||
|
||||
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
|
||||
$olddir =~ s/\//\\\\\//g;
|
||||
chomp($olddir);
|
||||
|
||||
my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
|
||||
my $rc = `$cmd`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$createnew = 1;
|
||||
@ -701,6 +748,18 @@ sub sysclone_createosimgdef{
|
||||
$osimgdef{$osimage}{osname} = "Linux";
|
||||
$osimgdef{$osimage}{osvers} = $osver;
|
||||
$osimgdef{$osimage}{osdistroname} = "$osver-$arch";
|
||||
|
||||
$osimgdef{$osimage}{rootimgdir} = $sysclone_home . "/images/" . $osimage;
|
||||
my $imagedir = $osimgdef{$osimage}{rootimgdir};
|
||||
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
|
||||
$imagedir =~ s/\//\\\\\//g;
|
||||
$imagedir = "DEFAULT_IMAGE_DIR = ".$imagedir;
|
||||
my $olddir = `more /etc/systemimager/systemimager.conf |grep DEFAULT_IMAGE_DIR`;
|
||||
$olddir =~ s/\//\\\\\//g;
|
||||
chomp($olddir);
|
||||
my $cmd= "sed -i \"s/$olddir/$imagedir/\" /etc/systemimager/systemimager.conf";
|
||||
my $rc = `$cmd`;
|
||||
|
||||
#$osimgdef{$osimage}{pkgdir} = "/install/$osver/$arch";
|
||||
#$osimgdef{$osimage}{otherpkgdir} = "/install/post/otherpkgs/$osver/$arch";
|
||||
}
|
||||
|
@ -4,11 +4,13 @@
|
||||
# This plugin is used to handle the command requests for Xeon Phi (mic) support
|
||||
#
|
||||
|
||||
|
||||
package xCAT_plugin::mic;
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
@ -612,6 +614,11 @@ sub rflash {
|
||||
# run the cmd on the host to flash the mic
|
||||
my @args = ("-s", "-v", "-e");
|
||||
push @args, "$::XCATROOT/sbin/flashmic";
|
||||
my $master = $request->{'_xcatdest'};
|
||||
# in case there are multiple servicenode entries, assume the first entry
|
||||
# is the master
|
||||
($master) = split (/,/,$master);
|
||||
|
||||
# assume that all hosts are on the same network connected to this master
|
||||
# (otherwise, will need to move this call into loop above for each host
|
||||
# and build separate miccfg calls for each unique returned value from
|
||||
@ -630,7 +637,6 @@ sub rflash {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
push @args, ("-m", "$master");
|
||||
push @args, ("-p", "$tftpdir/xcat/miccfg");
|
||||
|
||||
@ -930,6 +936,11 @@ sub nodeset {
|
||||
# run the cmd on the host to configure the mic
|
||||
my @args = ("-s", "-v", "-e");
|
||||
push @args, "$::XCATROOT/sbin/configmic";
|
||||
my $master = $request->{'_xcatdest'};
|
||||
# in case there are multiple servicenode entries, assume the first entry
|
||||
# is the master
|
||||
($master) = split (/,/,$master);
|
||||
|
||||
# assume that all hosts are on the same network connected to this master
|
||||
# (otherwise, will need to move this call into loop above for each host
|
||||
# and build separate miccfg calls for each unique returned value from
|
||||
|
@ -25,6 +25,7 @@ Getopt::Long::Configure("pass_through");
|
||||
use xCAT::Table;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::DBobjUtils;
|
||||
use xCAT::Utils;
|
||||
|
||||
sub handled_commands {
|
||||
return {
|
||||
@ -376,7 +377,9 @@ sub update_export {
|
||||
for my $l (@new_export) { print $new_export_fd $l; }
|
||||
flock($new_export_fd,LOCK_UN);
|
||||
close($new_export_fd);
|
||||
system("service nfs restart");
|
||||
#system("service nfs restart");
|
||||
my $retcode=xCAT::Utils->restartservice("nfs");
|
||||
return $retcode;
|
||||
}
|
||||
|
||||
sub update_syslog {
|
||||
@ -391,7 +394,9 @@ sub update_syslog {
|
||||
open($new_syslog_fd, ">>", "/etc/exports");
|
||||
print $new_syslog_fd "local2.* /var/log/nimol.log\n";
|
||||
close($new_syslog_fd);
|
||||
system("service rsyslog restart");
|
||||
#system("service rsyslog restart");
|
||||
my $retcode=xCAT::Utils->restartservice("rsyslog");
|
||||
return $retcode;
|
||||
} else {
|
||||
print "Don't need to update syslog configure file.\n";
|
||||
}
|
||||
|
@ -1521,9 +1521,11 @@ sub mksysclone
|
||||
}
|
||||
|
||||
# check systemimager-server-rsyncd to make sure it's running.
|
||||
my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
my $rc = xCAT::Utils->startService("systemimager-server-rsyncd");
|
||||
#my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
|
||||
#if ($::RUNCMD_RC != 0) { # not running
|
||||
my $retcode=xCAT::Utils->checkservicestatus("systemimager-server-rsyncd");
|
||||
if($retcode !=0){
|
||||
my $rc = xCAT::Utils->startservice("systemimager-server-rsyncd");
|
||||
if ($rc != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -453,8 +453,8 @@ if ($::INITIALINSTALL || $::FORCE)
|
||||
&setuphttp;
|
||||
|
||||
# chkconfig dhcpd on
|
||||
system("chkconfig dhcpd on");
|
||||
|
||||
#system("chkconfig dhcpd on");
|
||||
xCAT::Utils->enableservice("dhcp");
|
||||
|
||||
# Turn off selinux on RedHat
|
||||
if (-f "/etc/redhat-release")
|
||||
|
@ -2,6 +2,12 @@
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 configure_chef_server
|
||||
#=head2 This command configures the chef server on a xCAT node.
|
||||
@ -35,7 +41,8 @@ then
|
||||
then
|
||||
echo -e "\n/etc/chef-server *(rw,no_root_squash,sync,no_subtree_check)\n" >> /etc/exports
|
||||
fi
|
||||
sudo /etc/init.d/nfs-kernel-server restart
|
||||
#sudo /etc/init.d/nfs-kernel-server restart
|
||||
sudo restartservice nfs-kernel-server
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errmsg="Failed to run sudo /etc/init.d/nfs-kernel-server restart on $node"
|
||||
@ -43,7 +50,8 @@ then
|
||||
echo $errmsg
|
||||
exit 1
|
||||
fi
|
||||
service portmap restart
|
||||
#service portmap restart
|
||||
startservice portmap
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errmsg="Failed to run service portmap restart on $node"
|
||||
|
@ -1,8 +1,16 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
BEGIN
|
||||
{
|
||||
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
|
||||
}
|
||||
use lib "$::XCATROOT/lib/perl";
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
use xCAT::Utils;
|
||||
|
||||
Getopt::Long::Configure("bundling");
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
|
||||
@ -83,12 +91,14 @@ if (-f "/etc/redhat-release")
|
||||
system($cmd);
|
||||
|
||||
# restart iptables
|
||||
$cmd = "service iptables restart";
|
||||
system($cmd);
|
||||
#$cmd = "service iptables restart";
|
||||
#system($cmd);
|
||||
xCAT::Utils->restartservice("firewall");
|
||||
|
||||
# iptables should be stared on reboot
|
||||
$cmd = "chkconfig iptables on";
|
||||
system($cmd);
|
||||
#$cmd = "chkconfig iptables on";
|
||||
#system($cmd);
|
||||
xCAT::Utils->enableservice("firewall");
|
||||
}
|
||||
elsif (-f "/etc/SuSE-release")
|
||||
{
|
||||
@ -129,14 +139,18 @@ elsif (-f "/etc/SuSE-release")
|
||||
close(CONFFILE);
|
||||
|
||||
# restart firewall
|
||||
my $cmd = "service SuSEfirewall2_setup restart";
|
||||
system($cmd);
|
||||
#my $cmd = "service SuSEfirewall2_setup restart";
|
||||
#system($cmd);
|
||||
xCAT::Utils->restartservice("SuSEfirewall2_setup");
|
||||
|
||||
# SuSEfirewall2_setup should be stared on reboot
|
||||
$cmd = "chkconfig SuSEfirewall2_init on";
|
||||
system($cmd);
|
||||
$cmd = "chkconfig SuSEfirewall2_setup on";
|
||||
system($cmd);
|
||||
#$cmd = "chkconfig SuSEfirewall2_init on";
|
||||
#system($cmd);
|
||||
#$cmd = "chkconfig SuSEfirewall2_setup on";
|
||||
#system($cmd);
|
||||
xCAT::Utils->enableservice("SuSEfirewall2_init");
|
||||
xCAT::Utils->enableservice("SuSEfirewall2_setup");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -18,6 +18,10 @@
|
||||
# NETWORKS_LINE3='netname=ib3||net=15.0.3.0||mask=255.255.255.0||mgtifname=||gateway=||dhcpserver=||tftpserver=||nameservers=||ntpservers=||logservers=||dynamicrange=||staticrange=||staticrangeincrement=||nodehostname=||ddnsdomain=||vlanid=||domain=||disable=||comments='
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
#This is the number of ports for each ib adpator.
|
||||
portnum=1
|
||||
if [ -n "$NIC_IBAPORTS" ]; then
|
||||
@ -68,15 +72,19 @@ PLTFRM=`uname`
|
||||
if [[ $OSVER == rhels5* || "$OSVER" == rhels6* ]]
|
||||
then
|
||||
ib_driver="rdma"
|
||||
/sbin/service $ib_driver status
|
||||
if [ $? -eq 1 ]
|
||||
#/sbin/service $ib_driver status
|
||||
checkservicestatus $ib_driver
|
||||
#if [ $? -eq 1 ]
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
ib_driver="openibd"
|
||||
/sbin/service $ib_driver status
|
||||
if [ $? -eq 1 ]
|
||||
#/sbin/service $ib_driver status
|
||||
checkservicestatus $ib_driver
|
||||
#if [ $? -eq 1 ]
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Not found the driver dameon: rdma or openibd"
|
||||
logger -p local4.info -t xcat "Not found the driver dameon: rdma or openibd"
|
||||
logger -p local4.info -t xcat "Not found the driver dameon: rdma or openibd"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
@ -111,8 +119,10 @@ then
|
||||
echo "$TMP3" > /etc/modprobe.conf
|
||||
echo 'options ib_ehca lock_hcalls=0' >> /etc/modprobe.conf
|
||||
fi
|
||||
/sbin/chkconfig --level 2345 $ib_driver on > /dev/null 2>&1
|
||||
/sbin/service $ib_driver restart
|
||||
#/sbin/chkconfig --level 2345 $ib_driver on > /dev/null 2>&1
|
||||
enableservice $ib_driver > /dev/null 2>&1
|
||||
#/sbin/service $ib_driver restart
|
||||
restartservice $ib_driver
|
||||
sysctl -p
|
||||
fi
|
||||
|
||||
@ -490,7 +500,8 @@ done # end for nic
|
||||
if [ $PLTFRM == "Linux" ]
|
||||
then
|
||||
|
||||
/sbin/service $ib_driver restart
|
||||
#/sbin/service $ib_driver restart
|
||||
restartservice $ib_driver
|
||||
for nic in `echo "$goodnics" | tr "," "\n"`
|
||||
do
|
||||
sleep 5
|
||||
|
@ -3,6 +3,11 @@
|
||||
#(C)IBM Corp
|
||||
#
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
# create /etc/sysconfig/network-scripts/
|
||||
pmatch ()
|
||||
{
|
||||
@ -175,7 +180,8 @@ EOF
|
||||
/usr/bin/find . | cpio -H newc -o|gzip -9 -c - > /boot/${KDUMPINIT}
|
||||
cd /
|
||||
/bin/rm -rf "/var/tmp/tempinit"
|
||||
service kdump restart
|
||||
#service kdump restart
|
||||
restartservice kdump
|
||||
else
|
||||
/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH
|
||||
KDTEMPPATH=${KDPATH//\//\\\/}
|
||||
@ -208,7 +214,8 @@ EOF
|
||||
/bin/mount -o nolock $KDIP:$KDPATH $MOUNTPATH
|
||||
echo "net $KDIP:$KDPATH" > /etc/kdump.conf
|
||||
echo "link_delay 180" >> /etc/kdump.conf
|
||||
/etc/init.d/kdump restart
|
||||
#/etc/init.d/kdump restart
|
||||
restartservice kdump
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -2,6 +2,10 @@
|
||||
# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
#=head1 install_puppet_server
|
||||
#=head2 This command installs the puppet server on a xCAT server or node.
|
||||
@ -82,9 +86,11 @@ if [ "$os" == "Ubuntu" ]; then
|
||||
${result}/config_puppet_server "$@"
|
||||
|
||||
#restart puppet master
|
||||
service puppetmaster stop
|
||||
#service puppetmaster stop
|
||||
stopservice puppetmaster
|
||||
kill $(ps auxww | grep puppet | grep master | grep -v grep | awk '{print $2}')
|
||||
service puppetmaster start
|
||||
#service puppetmaster start
|
||||
startservice puppetmaster
|
||||
|
||||
elif [ "$os" == "RedHat" ]; then
|
||||
echo "Puppet server installation with xCAT on RedHat is through a kit. Please refer to ... for details.".
|
||||
|
@ -11,6 +11,12 @@
|
||||
# id.rsa
|
||||
#
|
||||
# if on the Management Node, exit
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
if [ -e /etc/xCATMN ]; then
|
||||
logger -t xcat -p local4.info "remoteshell:Running on the Management Node , exiting "
|
||||
exit 0
|
||||
@ -376,10 +382,12 @@ then
|
||||
chmod 0755 /var/run/sshd
|
||||
/usr/sbin/sshd -f /etc/ssh/sshd_config
|
||||
else
|
||||
service ssh restart
|
||||
#service ssh restart
|
||||
restartservice ssh
|
||||
fi
|
||||
else
|
||||
service sshd restart
|
||||
#service sshd restart
|
||||
restartservice sshd
|
||||
fi
|
||||
|
||||
kill -9 $CREDPID
|
||||
|
@ -5,6 +5,12 @@
|
||||
# setup NTP configuration on the compute nodes
|
||||
#
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
# if on the Management Node, exit
|
||||
if [ -e /etc/xCATMN ]; then
|
||||
logger -t xcat -p local4.info "setupntp:Running on the Management Node , exiting "
|
||||
@ -120,15 +126,17 @@ if [ $OS_TYPE = Linux ]; then
|
||||
disable auth
|
||||
restrict 127.0.0.1" >>$conf_file
|
||||
# default service for redhat/fedora
|
||||
SERVICE=ntpd
|
||||
if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ); then
|
||||
SERVICE=ntp
|
||||
fi
|
||||
#SERVICE=ntpd
|
||||
#if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ); then
|
||||
# SERVICE=ntp
|
||||
#fi
|
||||
|
||||
#ntpdate/sntp conflict with ntpd, stop the service first
|
||||
service $SERVICE status
|
||||
# service $SERVICE status
|
||||
checkservicestatus ntpserver
|
||||
if [ $? -eq 0 ];then
|
||||
service $SERVICE stop
|
||||
# service $SERVICE stop
|
||||
stopservice ntpserver
|
||||
fi
|
||||
#ntpdate program is deprecated on SuSE
|
||||
if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ]; then
|
||||
@ -178,23 +186,27 @@ restrict 127.0.0.1" >>$conf_file
|
||||
echo "#!/bin/sh" > $cron_file
|
||||
echo "/sbin/hwclock --systohc --utc" >> $cron_file
|
||||
chmod a+x $cron_file
|
||||
service cron restart
|
||||
#service cron restart
|
||||
restartservice cron
|
||||
fi
|
||||
fi
|
||||
service $SERVICE start
|
||||
#service $SERVICE start
|
||||
startservice ntpserver
|
||||
|
||||
#start ntp and crontab automaticlly
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
update-rc.d cron defaults
|
||||
update-rc.d $SERVICE defaults
|
||||
else
|
||||
chkconfig --add $SERVICE >/dev/null 2>&1
|
||||
chkconfig --level 345 $SERVICE on >/dev/null 2>&1
|
||||
if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then
|
||||
chkconfig --add cron >/dev/null 2>&1
|
||||
chkconfig --level 345 cron on >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
#if [ -f "/etc/debian_version" ];then
|
||||
# update-rc.d cron defaults
|
||||
# update-rc.d $SERVICE defaults
|
||||
#else
|
||||
# chkconfig --add $SERVICE >/dev/null 2>&1
|
||||
# chkconfig --level 345 $SERVICE on >/dev/null 2>&1
|
||||
# if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then
|
||||
# chkconfig --add cron >/dev/null 2>&1
|
||||
# chkconfig --level 345 cron on >/dev/null 2>&1
|
||||
# fi
|
||||
#fi
|
||||
enableservice cron
|
||||
enableservice ntpserver
|
||||
else
|
||||
# stop and start AIX ntp
|
||||
echo "driftfile /etc/ntp.drift
|
||||
|
@ -7,6 +7,12 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
|
||||
# Configuration for the sudoer
|
||||
SUDOER="xcat"
|
||||
SUDOERPW="rootpw"
|
||||
@ -53,8 +59,9 @@ chown $SUDOER:users $HOME/.ssh/authorized_keys
|
||||
|
||||
# Restart the SSHD for syncfiles postscript to do the sync work
|
||||
logger -t xCAT -p local4.info "Restarting SSHD"
|
||||
if [ -f "/etc/debian_version" ];then
|
||||
service ssh restart
|
||||
else
|
||||
service sshd restart
|
||||
fi
|
||||
#if [ -f "/etc/debian_version" ];then
|
||||
# service ssh restart
|
||||
#else
|
||||
# service sshd restart
|
||||
#fi
|
||||
restartservice ssh
|
||||
|
@ -14,6 +14,11 @@
|
||||
#=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
str_dir_name=`dirname $0`
|
||||
|
||||
. $str_dir_name/xcatlib.sh
|
||||
|
||||
master=$MASTER
|
||||
conf_file="/etc/syslog.conf"
|
||||
sysconfig="/etc/sysconfig/syslog"
|
||||
@ -23,7 +28,7 @@ isSN=0
|
||||
isLinux=1
|
||||
isRsyslog=0
|
||||
isC3=0
|
||||
systemdEnabled=0
|
||||
#systemdEnabled=0
|
||||
# pmatch determines if 1st argument string is matched by 2nd argument pattern
|
||||
|
||||
pmatch ()
|
||||
@ -115,19 +120,19 @@ if [ "$NTYPE" = service ]; then
|
||||
isSN=1
|
||||
fi
|
||||
|
||||
if [ -e /etc/systemd ]; then
|
||||
systemdEnabled=1
|
||||
fi
|
||||
#if [ -e /etc/systemd ]; then
|
||||
# systemdEnabled=1
|
||||
#fi
|
||||
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
if ( pmatch $OSVER "fedora*" ) || ( pmatch $OSVER "rhels5*" ) || ( pmatch $OSVER "rhel6*" ) || ( pmatch $OSVER "rhels6*" ) || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ] || ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then
|
||||
if [ -e /etc/rsyslog.conf ]; then
|
||||
conf_file="/etc/rsyslog.conf"
|
||||
sysconfig="/etc/sysconfig/rsyslog"
|
||||
init="/etc/init.d/rsyslog"
|
||||
if [ $systemdEnabled -eq 1 ]; then
|
||||
init="rsyslog"
|
||||
fi
|
||||
#init="/etc/init.d/rsyslog"
|
||||
#if [ $systemdEnabled -eq 1 ]; then
|
||||
# init="rsyslog"
|
||||
#fi
|
||||
isRsyslog=1
|
||||
if ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then
|
||||
sysconfig="/etc/default/rsyslog"
|
||||
@ -328,11 +333,12 @@ if [ $isLinux -eq 0 ]; then
|
||||
fi
|
||||
done
|
||||
else
|
||||
if [ $systemdEnabled -eq 1 ]; then
|
||||
systemctl restart $init.service
|
||||
else
|
||||
$init restart
|
||||
fi
|
||||
#if [ $systemdEnabled -eq 1 ]; then
|
||||
# systemctl restart $init.service
|
||||
#else
|
||||
# $init restart
|
||||
#fi
|
||||
restartservice syslog
|
||||
fi
|
||||
|
||||
#keep a record
|
||||
|
@ -273,7 +273,7 @@ function servicemap {
|
||||
local svcmgrtype=$2
|
||||
local svclistname=
|
||||
|
||||
INIT_dhcp="dhcpd isc-dhcp-server";
|
||||
INIT_dhcp="dhcp3-server dhcpd isc-dhcp-server";
|
||||
SYSTEMD_dhcp="dhcpd.service";
|
||||
|
||||
INIT_nfs="nfsserver nfs nfs-kernel-server";
|
||||
@ -291,6 +291,15 @@ function servicemap {
|
||||
INIT_http="apache2 httpd";
|
||||
SYSTEMD_http="httpd.service";
|
||||
|
||||
INIT_ntpserver="ntpd ntp";
|
||||
SYSTEMD_ntpserver="ntpd.service";
|
||||
|
||||
INIT_mysql="mysqld mysql";
|
||||
SYSTEMD_mysql="mysqld.service";
|
||||
|
||||
INIT_ssh="sshd ssh";
|
||||
SYSTEMD_ssh="sshd.service";
|
||||
|
||||
local path=
|
||||
local retdefault=$svcname
|
||||
local svcvar=${svcname//[-.]/_}
|
||||
|
Loading…
x
Reference in New Issue
Block a user