免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4773 | 回复: 2

求 sybase 数据库的cluster suite双机脚本 [复制链接]

论坛徽章:
0
发表于 2007-07-15 14:12 |显示全部楼层
哪位发一个sybase 数据库的redhat cluster suite双机脚本,学习学习啊!
谢谢了

论坛徽章:
0
发表于 2007-07-16 09:56 |显示全部楼层
贴一个我自己写的,谨供参考:

  1. #!/bin/bash

  2. # Author: MichaelBibby <[email]michaelbibby@gmail.com[/email]>
  3. # Date: 2007.06.19

  4. # chkconfig: 345 78 78
  5. # description: Normal RC script for SYBASE.

  6. . /etc/init.d/functions

  7. SYBASE_USERNAME="sa"
  8. SYBASE_PASSWORD=""

  9. export SYBASE_HOME='/opt/sybase-12.5'
  10. export SYBASE_OCS='OCS-12_5'
  11. export SYBASE_ASE='ASE-12_5'
  12. # ************************************************
  13. # Warnning: Modify the RUN_xxx to fit your need.
  14. # Your startup script will be such as:
  15. #   ${SYBASE_HOME}/${SYBASE_ASE}/install/RUN_${SERVER}
  16. #   ${SYBASE_HOME}/${SYBASE_ASE}/install/RUN_${SERVER_BACKUP}
  17. export SERVER='SYBASE'
  18. export SERVER_BACKUP='SYB_BACKUP'
  19. # For multi-server
  20. # export SERVER='server1 server2'
  21. # export SERVER_BACKUP='server1_backup server2_backup'
  22. # ************************************************

  23. export LIB="${SYBASE_HOME}/${SYBASE_OCS}/lib"
  24. export PATH=$PATH:"${SYBASE_HOME}/${SYBASE_ASE}/bin:${SYBASE_HOME}/${SYBASE_ASE}/install:${SYBASE_HOME}/${SYBASE_OCS}/bin"

  25. start_db()
  26. {
  27.     su - sybase -c "${SYBASE_HOME}/${SYBASE_ASE}/install/startserver \
  28.     -f ${SYBASE_HOME}/${SYBASE_ASE}/install/RUN_${SERVER}"

  29.     su - sybase -c "${SYBASE_HOME}/${SYBASE_ASE}/install/startserver \
  30.     -f ${SYBASE_HOME}/${SYBASE_ASE}/install/RUN_${SERVER_BACKUP}"
  31. }

  32. stop_db()
  33. {
  34.     ${SYBASE_HOME}/${SYBASE_OCS}/bin/isql \
  35.     -U${SYBASE_USERNAME} \
  36.     -P${SYBASE_PASSWORD} \
  37.     -S${SERVER} <<EOF
  38. shutdown ${SERVER_BACKUP}
  39. go
  40. exit
  41. EOF

  42.     ${SYBASE_HOME}/${SYBASE_OCS}/bin/isql \
  43.     -U${SYBASE_USERNAME} \
  44.     -P${SYBASE_PASSWORD} \
  45.     -S${SERVER} <<EOF
  46. use master
  47. go
  48. checkpoint
  49. go
  50. shutdown  
  51. go
  52. exit
  53. EOF

  54. if [ X"$?" == X"0" ]; then
  55.     exit 0
  56. else
  57.     exit 1
  58. fi
  59. }

  60. status_db()
  61. {
  62.     chk_sybase=$(ps axw --cols 32768 | grep dataserver | grep -v grep | wc -l)
  63.     if [ X"$chk_sybase" = X"0" ]
  64.     then
  65.         echo -n "Checking Master Server: ${SERVER}"
  66.         echo_failure
  67.         echo
  68.     else
  69.         echo -n "Checking Master Server: ${SERVER_BACKUP}" && echo_success
  70.     fi

  71.     chk_sybase_bs=$(ps axw --cols 32768 | grep backupserver | grep -v grep | wc -l)
  72.     if [ X"$chk_sybase_bs" = X"0" ];then
  73.         echo -n "Checking Backup Server: ${SERVER_BACKUP}"
  74.         echo_failure
  75.         echo
  76.     else
  77.         echo -n "Checking Backup Server: ${SERVER_BACKUP}" && echo_success
  78.     fi

  79.     exit 0
  80. }
  81.    

  82. case $1 in
  83.     start) start_db ;;
  84.     stop)
  85.         ps aux | grep -i dataserver | grep -v grep >/dev/null

  86.         if [ X"$?" == X"0" ]; then
  87.             stop_db
  88.         else
  89.             exit 0
  90.         fi
  91.         ;;
  92.     status) status_db ;;
  93.     *) echo "USAGE: $0 [start|stop|status]" ;;
  94. esac
复制代码

论坛徽章:
0
发表于 2007-07-16 12:05 |显示全部楼层
非常感谢!!!!!!!!!!!!1
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP