前端之家收集整理的这篇文章主要介绍了
rex 切换到oracle用户执行脚本,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
my @DBARR=('188.2.247.50','188.2.247.51','188.2.247.5','188.2.247.6','188.16.68.3','188.16.68.4','188.2.231.3','188.2.231.4','188.2.231.8','188.2.231.9','188.2.247.17','188.2.247.18','188.16.32.25','188.16.32.26','188.3.248.5','188.3.248.6');
group DBARR=>@DBARR;
task "check_lock",group=>"DBARR",sub {
my $current_server = connection->server;
chomp $current_server;
say $current_server;
file "/tmp/check_lock.sh",source => "/root/rexdb/rex/database/check_lock.sh",mode => 755,owner => "oracle",group => "dba";
my @output = run "su - oracle -c /tmp/check_lock.sh";
say @output;
my $output;
foreach $output (@output){
$output=~s/[\r\n]//;
my @array=split /\s+/,$output;
say $array[-1];
if ($array[-1] >= 5){
&SendELK("DbLockWarning->${current_server}->$output");
};
};
};
原文链接:https://www.f2er.com/oracle/207011.html