湖南麒麟快速启动优化

1、修改grub.cfg内的timeout配置

grub.cfg位于/boot/grub2文件夹内

湖南麒麟快速启动优化_第1张图片

将其中63行和67行的timeout=5修改为timeout=1

2、打开networkManager.service服务 

systemctl enable NetworkManager.service

湖南麒麟快速启动优化_第2张图片

 

输入命令后如果没有输出信息证明该服务已经打开,跳过此步骤

3、修改rc.local脚本

修改rc.local脚本如下(不包含上电自启动的应用程序)

湖南麒麟快速启动优化_第3张图片

 

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

modprobe ipmi_devintf
modprobe ipmi_si ports=0x360
ipmitool raw 6 0x26

cd /home/Xilinx_Answer_65444_Linux_Files/tests
./load_driver.sh

cd /home/dal/dal
insmod dal_kernel.ko

chmod 777 /opt/pet/vpx_net.sh
/opt/pet/vpx_net.sh

rm -f /tmp/.X11-unix/X*
rm -f /.VNC/*.pid
rm -f /.VNC/*.log

4、修改vpx_net.sh脚本

vpx_net.sh脚本修改为检测到槽位号不变后不再重新配置网络

#!/bin/bash

vpx_eth_name=("enp2s0f0" "enp2s0f1" "enp7s0" "enp9s0f0" "enp9s0f1" "enp9s0f2" "enp9s0f3")

net_vpx_autocfg()
{
	echo "vpx_net_autocfg"
	vpx_get_eth_name=(${vpx_eth_name[*]})
	cd /opt/pet
	get_info=`./slot_test`

	get_slotid=$(echo $get_info | cut -d ' ' -f 1)
	get_chassisid=$(echo $get_info | cut -d ' ' -f 2)
	get_rackid=$(echo $get_info | cut -d ' ' -f 3)

	org_slotid=$(echo `hostname` | cut -d '-' -f 1 | tr -cd "[0-9]")
	org_chassisid=$(echo `hostname` | cut -d '-' -f 2)

	#printf 'slot is %d\n' $get_slotid
	#printf 'chasis is %d\n' $get_chassisid
	#printf 'rack is %d\n' $get_rackid

	if [ $get_slotid == $org_slotid ] && [ $get_chassisid == $org_chassisid ]
	then
		echo "do not change network"

	else
		hostnamectl set-hostname node${get_slotid}-${get_chassisid}

		cd /opt/pet/net
		unalias cp
		cp ifcfg-enp* /etc/sysconfig/network-scripts/

	    cd /etc/sysconfig/network-scripts/

		get_ip4=$(expr $get_slotid \* 10 + $get_chassisid)

		ifdown  ifcfg-${vpx_get_eth_name[0]}
		sed -i '/IPADDR=/d'  ifcfg-${vpx_get_eth_name[0]}
		echo "IPADDR=192.168.80.$get_ip4" >>  ifcfg-${vpx_get_eth_name[0]}
		ifup   ifcfg-${vpx_get_eth_name[0]}

		ifdown   ifcfg-${vpx_get_eth_name[1]}
		sed -i '/IPADDR=/d'  ifcfg-${vpx_get_eth_name[1]}
		echo "IPADDR=192.168.90.$get_ip4" >>  ifcfg-${vpx_get_eth_name[1]}
		ifup   ifcfg-${vpx_get_eth_name[1]}

		ifdown   ifcfg-${vpx_get_eth_name[2]}
		sed -i '/IPADDR=/d'  ifcfg-${vpx_get_eth_name[2]}
		echo "IPADDR=192.168.100.$get_ip4" >>  ifcfg-${vpx_get_eth_name[2]}
		ifup   ifcfg-${vpx_get_eth_name[2]}

		ifdown   ifcfg-${vpx_get_eth_name[3]}
		sed -i '/IPADDR=/d'  ifcfg-${vpx_get_eth_name[3]}
		echo "IPADDR=192.168.3.$get_ip4" >>  ifcfg-${vpx_get_eth_name[3]}
		ifup   ifcfg-${vpx_get_eth_name[3]}

		ifdown   ifcfg-${vpx_get_eth_name[4]}
		sed -i '/IPADDR=/d'  ifcfg-${vpx_get_eth_name[4]}
		echo "IPADDR=192.168.4.$get_ip4" >>  ifcfg-${vpx_get_eth_name[4]}
		ifup  ifcfg-${vpx_get_eth_name[4]}

		ifdown  ifcfg-${vpx_get_eth_name[5]}
		sed -i '/IPADDR=/d' ifcfg-${vpx_get_eth_name[5]}
		echo "IPADDR=192.168.5.$get_ip4" >> ifcfg-${vpx_get_eth_name[5]}
		ifup  ifcfg-${vpx_get_eth_name[5]}

		ifdown  ifcfg-${vpx_get_eth_name[6]}
		sed -i '/IPADDR=/d' ifcfg-${vpx_get_eth_name[6]}
		echo "IPADDR=192.168.6.$get_ip4" >> ifcfg-${vpx_get_eth_name[6]}
		ifup  ifcfg-${vpx_get_eth_name[6]}

		sleep 1
		systemctl stop network.service 
		sleep 1
		systemctl start network.service 
	fi
}

net_vpx_autocfg


5、查看开机启动耗时服务,关闭部分服务

输入systemd-analyze blame可查看系统启动各项服务耗时

湖南麒麟快速启动优化_第4张图片

可以关闭的服务如下在终端中输入即可,如果没有返回值表面该服务已经关闭或不存在

systemctl disable lvm2-monitor.service
systemctl disable accounts-daemon.service
systemctl disable lm-sensors.service
systemctl disable kylin-dmesg.service
systemctl disable cups.path
systemctl disable cups-browsed.service
systemctl disable cups.service
systemctl disable NetworkManager-wait-online.service
systemctl disable remote-fs.target
systemctl disable lvm2-lvmetad.socket
systemctl disable lvm2-lvmpolld.socket
systemctl disable kylin-activation-check.service
systemctl disable apt-daily.timer
systemctl disable pppd-dns.service

 

你可能感兴趣的:(Felven在职场,linux,运维,服务器)