check-system-info/bin/check_job_sucessful.sh

31 lines
936 B
Bash

#!/bin/bash
#set -x
PRG="$0"
while [ -h "$PRG" ]; do
ls=$(ls -ld "$PRG")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '.*/.*' >/dev/null; then
PRG="$link"
else
PRG=$(dirname "$PRG")/"$link"
fi
done
PRGDIR=$(dirname "$PRG")
#full path
cd $PRGDIR
ROOT_DIR=$(pwd)
cd - >/dev/null
# 加载Python3环境
if [ -f /opt/rh/rh-python38/enable ]; then
source /opt/rh/rh-python38/enable
fi
function check_sucessful
recode=`mysql -uunadba -p1223Bc@2008 unary -e 'select 1-(tb1.n1/tb2.n2) from ( (select sum(number) as n1 from ( select operdesc,count(*) as number from tbl_jobhistory where policyname="长期系统" and compid="bd22ea57feecb5a7f96e67035c204e02" group by operdesc) as tmp1 where tmp1.operdesc like "%失败%") as tb1 right JOIN (select count(*) as n2 from tbl_jobhistory where policyname="长期系统" and compid="bd22ea57feecb5a7f96e67035c204e02") tb2 on 1=1);' | tail -1`