Chinaunix首页 | 论坛 | 博客
  • 博客访问: 661455
  • 博文数量: 291
  • 博客积分: 10025
  • 博客等级: 上将
  • 技术积分: 2400
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-04 12:04
文章分类

全部博文(291)

文章存档

2008年(102)

2007年(112)

2006年(75)

2004年(2)

我的朋友

分类: Sybase

2006-08-18 00:07:18

many tasks related to sybase ASE can only be executed after ASE is fully started, usually we can minitor the sybase errorlog or we isql into the ASE to see if the database is ready.

actually, there is a String in the errorlog we can determine ASE is fully started, it's "Recovery completed"

so if we can see this string in the end of errorlog, the ASE is fully started.

below is a script which can wait until ASE is fully start.

 

# waitsqlserver.sh

# determine if ASE is fully started, if yes in 10 minutes, return true; otherwise return false

READYMARK="Recovery complete"
typeset -i TRY=0 # TRY loop start from zero
typeset -i MAXTRY=60 # max try times, sp wait timeout will be MAXTRY * TRYINTERVAL = 600 = 10 minutes
typeset -i TRYINTERVAL=10 # unit is second, the time between 2 try

_isASEready() {
 grep -q "$READYMARK" $TMPSTARTLOG
}

while (( TRY < MAXTRY ))
do
 if _isASEready ; then
  ((STARTUPTIME=TRY*TRYINTERVAL))
  echo $STARTUPTIME
  export STARTUPTIME
  exit 0
 fi
 ((TRY=TRY+1))
 sleep $TRYINTERVAL
done
exit 1

 

阅读(943) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~