Relhat7.5 跑reboot n times 系统设置

Relhat7.5 跑reboot n times 系统设置
1. 编辑/etc/rc.d/rc.local 文件, 将脚本路径写到rc.local 最后面,如:bash /root/Desktop/reboot.sh
将rc.local的权限添加为可执行权限,如:chmod +x rc.local

  1. 如果系统运行reboot脚本后没有将设置还原,系统出现无限重启的情况,如何解决?
    :在即将进入系统时,按“e”键,然后在quiet 加 1,

这里写图片描述

  1. 再按ctrl+x ,然后输入密码进入单用户模式。
    这里写图片描述

  2. 在路径/etc/rc.d 下,找到rc.local,把rc.local 的执行权限去掉,如:chmod –x rc.local,再reboot 重启

  3. Reboot 脚本
#! /bin/bash

modprobe ipmi_msghandler
modprobe ipmi_devintf
modprobe ipmi_si

# author RL_T4
# date  08/29/2018
# for Huawei Test Reliability T4repaet 100 time !
# Version 0.2
# change List:Replace echo with a variable

# set drive variable
time=`issdcm -drive_list |grep -i "index" |wc -l`

# add test times log
if [ ! -f /root/Desktop/Test.log ]; then
touch /root/Desktop/Test.log
modprobe ipmi_si
ipmitool sel clear
>/var/log/messages
echo "1" > /root/Desktop/Test.log
fi

# recard test times
time_file=`cat /root/Desktop/Test.log`
nowtime=`expr $time_file + 1`
echo "$nowtime" >/root/Desktop/Test.log
for ((i=0; i<$time; i++))
do
echo "$time_file" >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
done



# Save all slot smart info 
if [ ! -f /root/Desktop/RL_T4/PASS.log ]; then
        for ((i=0; i<$time; i++))
        do
        issdcm -drive_index $i -smart > /root/Desktop/RL_T4/Slot$i.log
        echo "pass" > /root/Desktop/RL_T4/PASS.log
        done
fi

# Save all drive smart info
for ((i=0; i<$time; i++))
do
echo "The drive_index $1 smart infomation : " >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
done


for ((i=0; i<$time; i++))
do
issdcm -drive_index $i -smart >> /root/Desktop/RL_T4/Disk_$i.log
done

# Save all drive link speed
for ((i=0; i<$time; i++))
do
echo "The drive_index $1 link speed : " >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
done

if [ ! -f /root/Desktop/Bus_List.log ]; then
        touch /root/Desktop/Bus_List.log
fi
lspci -vvv |grep "Non-Volatile" >> /root/Desktop/Bus_List.log
Bus=`cat /root/Desktop/Bus_List.log`

slot1=`sed -n 1p /root/Desktop/Bus_List.log`
slot2=`sed -n 2p /root/Desktop/Bus_List.log`
slot3=`sed -n 3p /root/Desktop/Bus_List.log`
slot4=`sed -n 4p /root/Desktop/Bus_List.log`
slot5=`sed -n 5p /root/Desktop/Bus_List.log`
slot6=`sed -n 6p /root/Desktop/Bus_List.log`
slot7=`sed -n 7p /root/Desktop/Bus_List.log`
slot8=`sed -n 8p /root/Desktop/Bus_List.log`
slot9=`sed -n 9p /root/Desktop/Bus_List.log`
slot10=`sed -n 10p /root/Desktop/Bus_List.log`
slot11=`sed -n 11p /root/Desktop/Bus_List.log`
slot12=`sed -n 12p /root/Desktop/Bus_List.log`
echo ${slot1:0:7} > /root/Desktop/slot1_Bus.log
echo ${slot2:0:7} > /root/Desktop/slot2_Bus.log
echo ${slot3:0:7} > /root/Desktop/slot3_Bus.log
echo ${slot4:0:7} > /root/Desktop/slot4_Bus.log
echo ${slot5:0:7} > /root/Desktop/slot5_Bus.log
echo ${slot6:0:7} > /root/Desktop/slot6_Bus.log
echo ${slot7:0:7} > /root/Desktop/slot7_Bus.log
echo ${slot8:0:7} > /root/Desktop/slot8_Bus.log
echo ${slot9:0:7} > /root/Desktop/slot9_Bus.log
echo ${slot10:0:7} > /root/Desktop/slot10_Bus.log
echo ${slot11:0:7} > /root/Desktop/slot11_Bus.log
echo ${slot12:0:7} > /root/Desktop/slot12_Bus.log
slot1_Bus_ID=`cat /root/Desktop/slot1_Bus.log`
slot2_Bus_ID=`cat /root/Desktop/slot2_Bus.log`
slot3_Bus_ID=`cat /root/Desktop/slot3_Bus.log`
slot4_Bus_ID=`cat /root/Desktop/slot4_Bus.log`
slot5_Bus_ID=`cat /root/Desktop/slot5_Bus.log`
slot6_Bus_ID=`cat /root/Desktop/slot6_Bus.log`
slot7_Bus_ID=`cat /root/Desktop/slot7_Bus.log`
slot8_Bus_ID=`cat /root/Desktop/slot8_Bus.log`
slot9_Bus_ID=`cat /root/Desktop/slot9_Bus.log`
slot10_Bus_ID=`cat /root/Desktop/slot10_Bus.log`
slot11_Bus_ID=`cat /root/Desktop/slot11_Bus.log`
slot12_Bus_ID=`cat /root/Desktop/slot12_Bus.log`

for ((i=0; i<$time; i++))
do
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
done

for Link_Speed in $slot1_Bus_ID $slot2_Bus_ID $slot3_Bus_ID $slot4_Bus_ID $slot5_Bus_ID $slot6_Bus_ID $slot7_Bus_ID $slot8_Bus_ID $slot9_Bus_ID $slot10_Bus_ID $slot11_Bus_ID $slot12_Bus_ID
do
for ((i=0; i<$time; i++))
do
echo $Link_Speed
lspci -s $Link_Speed -vvvxxx |grep -i "Speed" >> /root/Desktop/RL_T4/Disk_$i.log
done
done
#Save System info 
for ((i=0; i<$time; i++))
do
echo "The system info : " >> /root/Desktop/RL_T4/Disk_$i.log
done

for ((i=0; i<$time; i++))
do
dmesg >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
echo "" >> /root/Desktop/RL_T4/Disk_$i.log
done

# set fio drive variable
#drive_list=(`issdcm -drive_list | grep "DevicePath" | grep nvme |awk -F ":" '{print $NF}' | awk -F "/" '{print $NF}'`)
#for drive in ${drive_list[@]}
#do
#echo ${drive_list[@]}
#fio --ioengine=libaio --randrepeat=0 --norandommap --thread --direct=1 --group_reporting --name=mytest --runtime=120 --time_based --numjobs=1 --iodepth=32 --filename=/dev/$drive --rw=randrw --rwmixread=50 --bs=512k --output=/root/Desktop/RL_T4/4K_randR.log &
#done

#sleep 60

if [ "$time_file" -le 99 ]
then
rm -f /root/Desktop/Bus_List.log
echo "PASS$time_file time"  >/media/reboottimes.txt
reboot
fi

ipmitool sel list > /root/Desktop/RL_T4/Bmc.log
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值