分类:
2008-05-23 19:08:46
AIX升级TL/ML后,要求必须重启一次,但不重启也一样能用。记得LOVEUNIX上以前就有人问,如何判断系统升级后,是否重启过服务器。今天有空,写了个办法:
#!/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
========================================================================
任何形式的转载,请写明出处:
email:
blog: http://blog.chinaunix.net/index.php?blogId=739 http://www.cublog.cn/u/739/
========================================================================