#过滤oracle警告日志文件ORA-错误
$c=Get-Content C:\script.txt | select-string -pattern "ora-"
#判断ORA-错误存在条件
#若$c返回值为null,则输出1返回值结束循环
if ( $c -eq $null )
{
write-host "STATE_OK"
$STATE_OK = {return 1;}
$b = &$STATE_OK
$b
}
#若$c返回值不为空,则复制oracle警告日志,清空原警告日志,返回0结束循环
else
{
copy C:\script.txt C:\scriptbak.txt
write-host "STATE_ERROR"
write-host "$c"
" " > C:\script.txt
$STATE_CRITICAL = {return 0;Write-Host "$c" }
$a = &$STATE_CRITICAL
$a
}
powershell_读取ORA错误脚本
最新推荐文章于 2024-11-06 19:36:22 发布