根据需求添加自己的条件
#!/bin/bash
i=1
while [ ${i} -le 50 ]
do
disk=$(lsblk |grep "^nvme0n1"|wc -l)
if [ ${disk} -eq 1 ];then
echo 'reboot_aq'
else
echo 'wait'
fi
let i=i+1
echo "${i}"
done
纯判断脚本
#!/bin/bash
sde2=$(df |grep sde2|awk '{print $1}')
if [ ! ${sde2} ];then
echo "sde error"
exit
else
echo "sde success"
fi
work=/opt/collect/20-eth0.network
work1=/opt/collect/21-eth1.network
#ls -l /opt/collect/20-eth0.network >/dev/null 2>&1
#if [ $? -eq 0 ];then
if [ -f ${work} ];then
echo "fileexist success"
elif [ -L "/etc/systemd/network/20-eth0.network" ];then
echo "profile error"
exit
else
cp /etc/systemd/network/20-eth0.network /opt/collect/20-eth0.network
echo "profile success"
fi
#ls -l /opt/collect/21-eth1.network >/dev/null 2>&1
#if [ $? -eq 0 ];then
if [ -f ${work1} ];then
echo "fileexist success"
elif [ -L "/etc/systemd/network/20-eth0.network" ];then
echo "profile error"
exit
else
cp /etc/systemd/network/21-eth1.network /opt/collect/21-eth1.network
echo "profile success"
fi