Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2722420
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: DB2/Informix

2011-02-21 16:10:17

#!/bin/bash
#
#---------------------------- /etc/init.d/db2 ------------------------
# db2
#
# description: Start up the db2 service

# Source function library.
. /etc/rc.d/init.d/functions

# Application owner
USER=dwapinst

RETVAL=0
prog="db2"

start() {
echo -n $"Starting $prog:"
initlog -c "/bin/su - $USER -c 'db2start'" && success || failure
RETVAL=$?
echo ""

}

status() {
initlog -c "/bin/su - $USER -c 'db2gcf -s'" && success || failure
RETVAL=$?
echo ""
}

stop() {
echo -n $"Stopping $prog:"

# Is DB2 already stopped?
status
if [ $RETVAL -gt 0 ]; then

# Already stoped return 0
echo "Already stopped"
success
RETVAL=0
echo ""
else
# DB2 must still be running. Stop it.
initlog -c "/bin/su - $USER -c 'db2 force application all'" && success || failure
sleep 5
initlog -c "/bin/su - $USER -c 'db2stop force'" && success || failure
sleep 5
initlog -c "/bin/su - $USER -c 'db2_kill'" && success || failure
echo ""
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;

status)
status
;;

restart)
stop
sleep 3
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
;;
esac

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