replace the service/chkconfig related stuff with newly added subroutine in xCAT::Utils
This commit is contained in:
parent
51add4de64
commit
f7b9a9a40b
@ -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
|
||||
@ -377,10 +383,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…
Reference in New Issue
Block a user