Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1099534
  • 博文数量: 414
  • 博客积分: 10030
  • 博客等级: 上将
  • 技术积分: 4440
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-05 21:42
文章分类

全部博文(414)

文章存档

2011年(1)

2009年(1)

2008年(412)

我的朋友

分类:

2008-10-13 09:37:38

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/
========================================================================
阅读(1152) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~