分类:
2008-10-13 09:37:38
#!/usr/bin/ksh
# function: AIX平台判断升级TL/ML后是否有过重启
# author: http://blog.chinaunix.net/index.php?blogId=739
set -A month Jan Feb Mar Apr Jun Jul Aug Sep Otc Nov Dec
i=0
for mon in ${month[@]};do
((i=i + 1))
istat /etc/bosboot.sum | awk '/updated:/ {print$4,$5,$6,$7}' | sed 's/:/ /g'| \
awk -v var=$mon '$1=="'"$mon"'"{printf "%04d%02d%02d%02d%02d%02d\n",$6,'"$i"',$2,$3,$4,$5}'
done | \
read bosboot
duration=`uptime | awk '{print $3,$5}' |awk -F[\ :,] '{print $1*86400+$2*3600+$3*60}'`
perl -le "); \
printf("%04d%02d%02d%02d%02d%02d\n",$a[5]+1900,$a[4]+1,$a[3],$a[2],$a[1],$a[0]);' | \
read uptime
echo $bosboot | sed 's/\(..\)/\1 /g' | \
awk '{print "Time of last boot image updating\t"$1$2"-"$3"-"$4" "$5":"$6":"$7}'
echo $uptime | sed 's/\(..\)/\1 /g' | \
awk '{print "Time of last reboot\t\t\t"$1$2"-"$3"-"$4" "$5":"$6":"$7}'
if [ $uptime > $bosboot ]
then
echo "\tYou needn't reboot this server."
else
echo "\tYou need reboot this server."
fi