linux远程启动&停止weblogic、分割日志、端口检测 脚本_Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4695 | 回复: 0   主题: linux远程启动&停止weblogic、分割日志、端口检测 脚本        下一篇 
barry
注册用户
等级:中校
经验:1534
发帖:236
精华:2
注册:2012-1-13
状态:离线
发送短消息息给barry 加好友    发送短消息息给barry 发消息
发表于: IP:您无权察看 2012-2-13 10:06:18 | [全部帖] [楼主帖] 楼主

linux远程启动&停止weblogic、分割日志、端口检测 脚本

startWLS.sh
--------------------------------------------------------------------
#!/usr/bin/expect -f
set count 3
set ip(1) "134.16.22.50"
set username(1) "weblogic"
set password(1) "weblogic"
set domainurl(1) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(1) "nohup ./startWebLogic.sh > jq_Admin.log &"
set ip(2) "134.16.22.50"
set username(2) "weblogic"
set password(2) "weblogic"
set domainurl(2) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(2) "nohup ./startManagedWebLogic.sh ProxyServer > jq_ProxyServer.log &"
set ip(3) "134.16.22.50"
set username(3) "weblogic"
set password(3) "weblogic"
set domainurl(3) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(3) "nohup ./startManagedWebLogic.sh Server_1 > jq_Server_1.log &"
for {set i 1} {$i <= $count} {incr i} {
      puts $i
      puts $ip($i)
      puts $username($i)
      puts $password($i)
      puts "cd $domainurl($i)"
      puts $cmd($i)
      spawn telnet $ip($i)
      expect "login:"
      send $username($i)
      send "\r"
      expect "Password:"
      send $password($i)
      send "\r"
      expect "]:"
      send "cd $domainurl($i)"
      send "\r"
      send $cmd($i)
      send "\r"
      sleep 3
      expect eof
}
exit
--------------------------------------------------------------------
stopWLS.sh
#!/usr/bin/expect -f
set count 3
set ip(1) "134.16.22.50"
set username(1) "weblogic"
set password(1) "weblogic"
set domainurl(1) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(1) "nohup ./stopWebLogic.sh > jq_Admin_stop.log &"
set ip(2) "134.16.22.50"
set username(2) "weblogic"
set password(2) "weblogic"
set domainurl(2) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(2) "nohup ./stopManagedWebLogic.sh ProxyServer > jq_ProxyServer_stop.log &"
set ip(3) "134.16.22.50"
set username(3) "weblogic"
set password(3) "weblogic"
set domainurl(3) "/bea/user_projects/domains/sxptccs_domain/bin"
set cmd(3) "nohup ./stopManagedWebLogic.sh Server_1 > jq_Server_1_stop.log &"
for {set i $count} {$i >= 1} {incr i -1} {
      puts $i
      puts $ip($i)
      puts $username($i)
      puts $password($i)
      puts "cd $domainurl($i)"
      puts $cmd($i)
      spawn telnet $ip($i)
      expect "login:"
      send $username($i)
      send "\r"
      expect "Password:"
      send $password($i)
      send "\r"
      expect "]:"
      send "cd $domainurl($i)"
      send "\r"
      send $cmd($i)
      send "\r"
      sleep 3
      expect eof
}
exit
--------------------------------------------------------------------
fglog.sh
#!/bin/sh
echo "shell /sxptccs/log/fglog.sh"
echo "--Begin time: "`date`" --"
logfile="/bea/user_projects/domains/base_gncs/bin/nohup.out"
echo "logfile: "${logfile}
fgurl="/sxptccs/log/"
echo "fgurl: "${fgurl}
H=`date "+%H"`
echo "now DATE-H: "${H}
cp ${logfile} ${fgurl}"gnlog_"`date "+%Y%m%d%H%M"`".log"
cp /dev/null ${logfile}
echo " fglog "`date`
while [ 1=1 ]
do
if [ `date "+%H"` -eq ${H} ];
then
sleep 1
else
cp ${logfile} ${fgurl}"gnlog_"`date "+%Y%m%d%H%M"`".log"
cp /dev/null ${logfile}
H=`date "+%H"`
echo " fglog "`date`
sleep 3600
fi
done
echo "--End time: "`date`" --"
--------------------------------------------------------------------
checkPort.sh
#!/usr/bin/expect -f
set timeout 1
set count 5
set result ""
# netstat -anp|grep 7080
# netstat -anp|grep 7080|wc -l
set ip(1) "134.16.22.50"
set username(1) "weblogic"
set password(1) "weblogic"
set port(1) 7080
set ip(2) "134.16.22.50"
set username(2) "weblogic"
set password(2) "weblogic"
set port(2) 8080
set ip(3) "134.16.22.47"
set username(3) "weblogic"
set password(3) "weblogic"
set port(3) 7070
set ip(4) "134.16.22.47"
set username(4) "weblogic"
set password(4) "weblogic"
set port(4) 4070
set ip(5) "134.16.22.47"
set username(5) "weblogic"
set password(5) "weblogic"
set port(5) 5070
for {set i 1} {$i <= $count} {incr i} {
      spawn telnet $ip($i)
      expect "login:"
      send $username($i)
      send "\r"
      expect "Password:"
      send $password($i)
      send "\r"
      expect "]$"
      send "netstat -anp|grep $port($i)\r"
set accum {}
      set tj 0
      expect {
            -re "tcp*" {
                  #set accum "$expect_out(0,string)"
                  set tj 1
                  exp_continue
            }
      }
      #puts "$accum"
if {$tj == 1} {
set result "${result}RESULT($tj): IP-$ip($i) prot-$port($i) is open\n"
      #lappend result "RESULT($tj): IP-$ip($i) prot-$port($i) is open\r"
} else {
set result "${result}RESULT($tj): IP-$ip($i) prot-$port($i) is close\n"
#lappend result "RESULT($tj): IP-$ip($i) prot-$port($i) is close\r"
}
expect eof
}
puts "\n---------CHECK PORT --------\n"
puts "$result"
puts "--------- END --------\n"
exit
--------------------------------------------------------------------




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论