/* =================================== Startacct. sh ===================================== */
#!/usr/bin/ksh./vbsvr_boot_boss.sh -s ./boss_server.lst > vbsvr_boot_boss.log &
/* ================================= Vbsvr_boot_boss.sh ====================== ===== */
#! /Usr/bin/kshuser_name = 'whoam' program _ name = 'basename $ 0' check _ interval = 15server_list = partition = 1debug_level = 0info_level = 1error_level = 2system_level = 3log_level = $ info_levelcheck_osagent = 0dry_run = 0total_server_num = 0processed_server_num = 0 # export LD_LIBRARY_PATH =/yzapp/opcrm/lib_rollback: $ LD_LIBRARY_PATH # parameters: mesters Elog_debugmsg () {if ["$ log_level"-Le "$ debug_level"] Then ECHO "[Debug:" 'date' + % Y-% m-% d % H: % m: % s ''"] $1 "fi} log_infomsg () {if [" $ log_level "-Le" $ info_level "] Then ECHO" [info: "'date' + % Y-% m-% d % H: % m: % S'"] $1 "fi} log_errormsg () {if ["$ log_level"-Le "$ error_level"] Then ECHO "[error:" 'date' + % Y-% m-% d % H: % m: % S' "] $1" fi} log_sysmsg () {if ["$ log_level"-Le "$ system_level"] Then E Cho "[system:" 'date' + % Y-% m-% d % H: % m: % S' "] $1" fi} # parameters: SERVER_NAME, instance_num, server_parameterscheck_format () {if [! -S $1] Then log_errormsg "server $1 not found, in server list file $ server_list "Exit 1 fi TMP = 'expr $2 + 1-1 2>/dev/null' if [" $ tmp "! = "$2"] Then log_errormsg "invalid instance_num ($2), need a integer, in server list file $ server_list" Exit 1 fi} # parameters: SERVER_NAME, instance_num, server_parameterscheck_server () {_ SERVER_NAME = 'basename $1 'log_debugmsg "checking for server: $ _ SERVER_NAME [instance_num = $2, param = \ "$3 \"] "_ inst_num = 0 _ try_num = 0 while [" $ _ try_num "-lt" $ server_retry_num "] Do if [" $ dry_run "- EQ "0"] Then _ Inst_num = 'ps-fu $ user_name | grep "/$ _ SERVER_NAME" | grep-V grep | WC-L | xargs expr 0 + 'else _ inst_num = $2 fi # echo "server $ _ SERVER_NAME require $2 try $ _ try_num current $ _ inst_num" If ["$ _ inst_num"-lt "$2"] Then log_debugmsg "Starting Server: $1 $3 "_ log_file_base =" $ ob_rel/log/$ _ SERVER_NAME. "'date + % H % m % s' _ command_line =" $1 $3 1>/dev/null 2>/dev/null & "# _ command_line =" $1 $3 1> $ _ log_file_ B ASE. stdout 2> $ _ log_file_base.stderr & "log_infomsg" Starting server with command line -- $ _ command_line "eval $ _ command_line sleep $ server_start_interval else log_infomsg" server $1 is OK, $ _ inst_num instance (s) "outputs = 'expr $ processed_server_num + $ _ inst_num 'export processed_server_num return fi _ try_num = 'expr $ _ try_num + 1 'done log_errormsg" server $1 failed $ _ try_num times, wil L start it later "processed_server_num = 'expr $ processed_server_num + $ _ inst_num 'export processed_server_num} # parameters: parameters () {_ SERVER_NAME = 'basename $1 'echo" shutdown _ SERVER_NAME: $ _ SERVER_NAME "log_infomsg" shutdowning Server: $ _ SERVER_NAME "_ try_num = 0 _ inst_num = 0 while [" $ _ try_num "-lt" $ server_retry_num "] Do _ inst_num = 'ps-fu $ user_name | grep "/ $ _ SERVER_NAME "| G Rep-V grep | WC-L | xargs expr 0 + 'echo "shutdown _ inst_num = $ _ inst_num _ try_num = $ _ try_num" If ["$ _ inst_num"-ge" 1 "] Then if [" $ dry_run "-EQ" 0 "] Then PS-fu $ user_name | grep"/$ _ SERVER_NAME "| grep-V grep | awk '{printf "Kill % s \ n ", $2} '| sh else _ inst_num = 0 fi sleep $ server_shutdown_interval fi _ try_num = 'expr $ _ try_num + 1 'doneecho "shutdown while done inst_num = $ inst_num _ try_num = $ _ t Ry_num "If [" $ _ inst_num "-ge" 1 "] Then log_errormsg" shutdown server failed: $ _ SERVER_NAME, $ _ inst_num left alive "attributes = 'expr $ processed_server_num + $ _ inst_num 'export processed_server_num else log_infomsg" server shutdowned: $ _ SERVER_NAME "fi} # parameters: commandprocess_server () {_ total_server_num = 0 #20090718 modify. The new parameter _ max_connetion_num is used to read the configuration of the maximum number of connections while read _ application _ Inst Ance_num _ port_start _ port_range _ max_connetion_num do _ is_comment = 'expr $ _ application: '# \ (. * \) ''if [" $ _ is_comment "! = ""] Then continue Fi if ["$ _ instance_num" = ""] Then _ instance_num = 1 fi _ total_server_num = 'expr $ _ total_server_num + $ _ instance_num 2>/dev /null '_ SERVER_NAME = "$ {ob_rel}/SVR/$ {_ application} _ SVR" #20090718 modify, change to read Public configuration mode _ parameter = "-M $ _ application-I $ {ob_rel}/config/acct_config_2.cfg" If ["$ _ max_connetion_num" = "2"] Then _ parameter = "-M $ _ application-I $ {ob_rel}/config/acct_config_2.cfg" fi If ["$ _ max_connetion_num" = "10"] Then _ parameter = "-M $ _ application-I $ {ob_rel}/config/acct_config_10.cfg" Fi if ["$ _ max_connetion_num "=" 20 "] Then _ parameter ="-M $ _ application-I $ {ob_rel}/config/acct_config_1_cfg "Fi if [" $ _ max_connetion_num "=" 30 "] then _ parameter = "-M $ _ application-I $ {ob_rel}/config/acct_config_30.cfg" Fi if ["$ _ max_connetion_num" = "0"] Then _ parameter = "- M $ _ app Lication-I $ {ob_rel}/config/acct_config_30_dq.cfg "fi # Add the boss dynamic service to load if [" $ _ max_connetion_num "=" Acct "] Then _ parameter ="-M dysvr_acct- I $ {ob_rel}/config/acct_dysvr.cfg "fi export vbport =$ _ port_start export vbrange =$ _ port_range export ob_orb_init =" dummy-dvbroker. orb. propstorage =$ {ob_rel}/config/VisiBroker. prop-dvbroker. se. iiop_tp.scm.iiop_tp.listener.port =$ {vbport}-dvbroker. se. iiop_tp.scm. I Iop_tp.listener.portrange =$ {vbrange} "If [$1 =" check "] Then check_server $ _ SERVER_NAME $ _ instance_num $ _ parameter $ _ application Elif [$1 =" shutdown "] Then shutdown_server $ _ SERVER_NAME Elif [$1 = "check_format"] Then check_format $ _ SERVER_NAME $ _ instance_num $ _ parameter else log_errormsg "invalid option for process_server (): $1 "Exit 1 fi done <$ server_list total_server_num = $ _ total_server _ Num} # parameters: on_exit () {if $ shutdown_all_on_exit then log_sysmsg "shutdowning all servers... "processed_server_num = 0 process_server" shutdown "If [" $ processed_server_num "-EQ" 0 "] Then log_sysmsg" all servers shutdowned! "Else log_errormsg" $ processed_server_num shutdowning down failed! "Fi log_sysmsg" $ program_name terminated! "Exit 1} # parameters: show_usage () {echo" $ program_name is a tool to boot and monitor openbroker server for VisiBroker "Echo" Usage: $ program_name [-H] [-D] [-C interval]-s server_list "Echo"-C Interval check interval for monitoring, default is $ check_interval seconds "Echo"-S server_list file contains server information "Echo" File Format: server_path, instance_num, parameter "Echo "-D shutdown all servers when exit" Echo "-H show this help message"} # parameters: check_env () {PS-U $ user_name-f | grep "\ <$ program_name \>" | grep-V grep instance_num = 'ps-U $ user_name-f | grep "\ <$ program_name \> "| grep-V grep | WC-L | xargs expr 0 + 'If [" $ instance_num "-ge" 2 "] Then log_errormsg" there's $ program_name running already "Exit 1 Fi if [" $ ob_rel "=" "] Then log_errormsg "Environment variable ob_rel not set, exit" Exit 1 else log_sysmsg "ob_rel = $ ob_rel" Fi if [! -D $ ob_rel/log] Then log_errormsg "log directory ($ ob_rel/log) not exists, exit "Exit 1 Fi if [$ check_osagent-EQ 1] Then _ osagent_num = 'ps-fu BES | grep osagent | grep $ osagent_port | grep-V grep | WC-L | xargs expr 0 + 'If ["$ _ osagent_num"-EQ "0"] Then log_errormsg "there's no osagent running on port $ osagent_port, exit "Exit 1 else log_sysmsg" $ _ osagent_num osagent (s) running on port $ OS Agent_port "fi _ TMP = 'expr $ check_interval + 1-1 2>/dev/null' if [" $ _ tmp "! = "$ Check_interval"] Then log_errormsg "invalid check interval ($ check_interval ), need a integer "Exit 1 Fi if [" $ server_list "="] Then log_errormsg "No server_list file, use-h to get help" Exit 1 Fi if [! -S $ server_list] Then log_errormsg "server_list File $ server_list not found" Exit-2 fi process_server "check_format"} # main part of scriptwhile getopts: HDC: s: optiondo case $ option in H) show_usage exit 0; d) shutdown_all_on_exit = true; c) check_interval = $ optarg; s) server_list = $ optarg ;;*) log_errormsg "Invalid Command Option: $ optarg" log_errormsg "use-h to get help" Exit 1; esacdoneifs =, check_envmkdir-p $ ob_rel/SVR/cores # coreadm-p $ ob_rel/SVR/cores/core. % F. % P # export ld_preload_32 = $ ob_rel/lib/libobpreload. sotrap "on_exit" 2 3 15 1>/dev/null 2>/dev/nulllog_sysmsg "monitoring servers... "While truedo processed_server_num = 0 process_server" check "log_sysmsg" $ total_server_num server (s), $ processed_server_num active. "#20090718 modifying ng no longer requires using the obtester service echo" Sleep $ check_interval seconds... "Sleep $ check_intervaldone
/* ================================== Boss_server.lst ============== ================= */
# Allocate # -- communication ports should be allocated in strict accordance with the following principles. Each product line should be adjusted internally # modify # add Port definitions # service configuration, port 36001 -- 38999 accauxmgnt, 10, 0 accbankreg, 30, 10, 20 accquery, medium, 10, 30 minutes, medium, 10, 10 accrefund, 10, 10 acctranbil, medium, 10, 2 accunpay, medium, 10, 10 minutes, medium, 10, 20 config, medium, 10, 10 detailquery, response, 10, 0 owemgnt, 10, 10 servrefundcheck, 10, 10, 10