【批量】
----------------------------此脚本批量查询dell服务器保修时间--------------------------------------------
----------------------------此脚本批量查询dell服务器保修时间-------------------------------------------
【单服查询】
----------------------------此脚本批量查询dell服务器保修时间--------------------------------------------
#!/bin/bash
date=`date +%Y-%m-%d-%H-%M`
pw=`pwd`
for i in `cat serviceID.txt`
do
wget http://www.dell.com/support/troubleshooting/cn/zh/cnbsd1/Servicetag/$i -P ${pw}/log &>/dev/null
time=`cat ${pw}/log/${i} | grep "no description available" | awk -F'<b>' '{ print $3 }' | awk -F'。' '{ print $1 }'`
echo -e "\033[31m 保修期截止日期为: $i $time \033[0m"
echo "$i,$time" >> serviceID$date.csv
done
date=`date +%Y-%m-%d-%H-%M`
pw=`pwd`
for i in `cat serviceID.txt`
do
wget http://www.dell.com/support/troubleshooting/cn/zh/cnbsd1/Servicetag/$i -P ${pw}/log &>/dev/null
time=`cat ${pw}/log/${i} | grep "no description available" | awk -F'<b>' '{ print $3 }' | awk -F'。' '{ print $1 }'`
echo -e "\033[31m 保修期截止日期为: $i $time \033[0m"
echo "$i,$time" >> serviceID$date.csv
done
----------------------------此脚本批量查询dell服务器保修时间-------------------------------------------
【单服查询】
#!/bin/bash
serviceID=`dmidecode -s system-serial-number`
IP=`ifconfig | grep inet | awk -F' ' '{ print $2 }' | sed "s/addr://g" | head -n 2 | sed '1{N;s/\n/ /}'`
wget http://www.dell.com/support/troubleshooting/cn/zh/cnbsd1/Servicetag/$serviceID > /dev/null 2>&1
if [ $? = 0 ]
then
time=`cat $serviceID | grep "no description available" | awk -F'<b>' '{ print $3 }' | awk -F'。' '{ print $1 }'`
echo -e "\033[31m 保修期截止日期为: $time \033[0m"
echo -e "\033[31m 此服务器IP信息为: $IP \033[0m"
fi
serviceID=`dmidecode -s system-serial-number`
IP=`ifconfig | grep inet | awk -F' ' '{ print $2 }' | sed "s/addr://g" | head -n 2 | sed '1{N;s/\n/ /}'`
wget http://www.dell.com/support/troubleshooting/cn/zh/cnbsd1/Servicetag/$serviceID > /dev/null 2>&1
if [ $? = 0 ]
then
time=`cat $serviceID | grep "no description available" | awk -F'<b>' '{ print $3 }' | awk -F'。' '{ print $1 }'`
echo -e "\033[31m 保修期截止日期为: $time \033[0m"
echo -e "\033[31m 此服务器IP信息为: $IP \033[0m"
fi