亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2074 | 回復(fù): 3
打印 上一主題 下一主題

寫一個支持cluster suite切換的應(yīng)用腳本 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2006-12-31 12:58 |只看該作者 |倒序瀏覽
一個CS的應(yīng)用程序腳本需要符合LSB標(biāo)準(zhǔn),需要支持以下幾個參數(shù)

start                    start the service
stop                     stop the service
restart                 stop and restart the service if the service is already running, otherwise start the service
try-restart            restart the service if the service is already running
reload                  cause the configuration of the service to be reloaded without actually stopping and restarting the service
force-reload          cause the configuration to be reloaded if the service supports this, otherwise restart the service if it is running
status                   print the current status of the service

你可以在/etc/init.d/下找到一些系統(tǒng)自帶服務(wù)的啟動腳本,比如ftp什么的,一般情況下他們都可以直接使用在CS中

如果你想編寫一個第三方應(yīng)用程序的腳本,那么一個帶注釋的例子如下


  1. #!/bin/bash

  2. #
  3. #  Copyright Red Hat Inc., 2002
  4. #  Copyright Mission Critical Linux, 2000
  5. #
  6. #  This program is free software; you can redistribute it and/or modify it
  7. #  under the terms of the GNU General Public License as published by the
  8. #  Free Software Foundation; either version 2, or (at your option) any
  9. #  later version.
  10. #
  11. #  This program is distributed in the hope that it will be useful, but
  12. #  WITHOUT ANY WARRANTY; without even the implied warranty of
  13. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. #  General Public License for more details.
  15. #
  16. #  You should have received a copy of the GNU General Public License
  17. #  along with this program; see the file COPYING.  If not, write to the
  18. #  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge,
  19. #  MA 02139, USA.
  20. #
  21. #
  22. #  Author: Gregory P. Myrdal <Myrdal@MissionCriticalLinux.Com>
  23. #

  24. #
  25. # This file contains a template that you can use to create a script
  26. # that will start, stop and monitor an application used in a cluster service.
  27. #

  28. #------------------------------------------------------------
  29. # Variable definitions
  30. #------------------------------------------------------------

  31. MYNAME=$(basename $0)

  32. # The clug utility uses the normal logging levels as defined in
  33. # sys/syslog.h.  Calls to clulog will use the logging level defined
  34. # for the Service Manager (clusvcmgrd).

  35. LOG_EMERG=0        # system is unusable
  36. LOG_ALERT=1        # action must be taken immediately
  37. LOG_CRIT=2        # critical conditions
  38. LOG_ERR=3        # error conditions
  39. LOG_WARNING=4        # warning conditions
  40. LOG_NOTICE=5        # normal but significant condition
  41. LOG_INFO=6        # informational
  42. LOG_DEBUG=7        # debug-level messages

  43. #------------------------------------------------------------
  44. # Start of execution
  45. #------------------------------------------------------------

  46. if [ $# -ne 2 ]; then
  47.         echo "Usage: $0 {start, stop, status} service_name"
  48.         exit 1
  49. fi

  50. action=$1                # type of action, i.e. 'start', 'stop' or 'status'
  51. svcName=$2                # name of the service

  52. #
  53. # Record all output into a temp file in case of error
  54. #
  55. exec > /tmp/$MYNAME.$action.log 2>&1

  56. clulog -s $LOG_DEBUG "In $0 with action=$action, svcName=$svcName"

  57. case $action in
  58. 'start')
  59.         clulog -s $LOG_INFO "Running user start script for service $svcName"
  60.         #
  61.         # <<< EDIT HERE: Add service start specfic code here >>>
  62.         #
  63.         ;;
  64. 'stop')
  65.         clulog -s $LOG_INFO "Running user stop script for service $svcName"
  66.         #
  67.         # <<< EDIT HERE: Add service stop specfic code here >>>
  68.         #
  69.         ;;
  70. 'status')
  71.         clulog -s $LOG_INFO "Running user status script for service $svcName"
  72.         #
  73.         # <<< EDIT HERE: Add service status specfic code here >>>
  74.         #
  75.         ;;
  76. *)
  77.         clulog -s $LOG_ERR \
  78.                 "Unknown action '$action' passed to $svcName user script"
  79.         exit 1                # return failure
  80. esac

  81. exit 0                        # return success
復(fù)制代碼




一個不符合lSB標(biāo)準(zhǔn)的腳本將導(dǎo)致,CS不停重起你的應(yīng)用程序,一個典型的例子就是httpd....oh my God !
詳情見bugzilla
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=151104

希望能拋磚引玉,大家share出自己的腳本作品和實踐中的經(jīng)驗教訓(xùn),共同提高

[ 本帖最后由 fuumax 于 2006-12-31 13:14 編輯 ]

論壇徽章:
0
2 [報告]
發(fā)表于 2006-12-31 13:30 |只看該作者
暈, 這玩意就看實際應(yīng)用了, 沒有什么好說的 . 不過想apache, mysql什么的好像沒有狀態(tài)控制. 代碼要加上
status選項. 選項控制可以根據(jù)自己具體使用情況, 加以判斷做流程控制..  感覺這些例子沒有什么用處.

論壇徽章:
0
3 [報告]
發(fā)表于 2006-12-31 14:24 |只看該作者
原帖由 haishen 于 2006-12-31 13:30 發(fā)表
暈, 這玩意就看實際應(yīng)用了, 沒有什么好說的 . 不過想apache, mysql什么的好像沒有狀態(tài)控制. 代碼要加上
status選項. 選項控制可以根據(jù)自己具體使用情況, 加以判斷做流程控制..  感覺這些例子沒有什么用處.



人家是好心總要支持一下嘛, 讓你這么折騰沒人愿來發(fā)貼了, 真是的,,,

論壇徽章:
0
4 [報告]
發(fā)表于 2006-12-31 14:42 |只看該作者
噢  嘿嘿 ,  我錯了  
鼓勵  鼓勵,  不會讓我一句不著邊的話就打死吧, 也太脆弱了.......
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP