#check status
. /home/oracle/.profile
cd /usr1/userdata/goldengate
echo "info all" |./ggsci|tail -n 34|sed 's/^GG.*//' > /tmp/ogg_monitor.log

#check lag
min_value=10

while read line
do
echo $line 
        lag_min=`echo $line |awk '{print $5}'|awk -F':' '{print $2}'`
        lag_process=`echo $line |awk '{print $3}'`
        comm1="kill "$lag_process
        comm2="start "$lag_process
        if  [[ $lag_min -gt $min_value ]];then
echo $comm1 |./ggsci
sleep 5
echo $comm2 |./ggsci
exit
EOF
        fi
done  </tmp/ogg_monitor.log



0,30 * * * * /home/oracle/kill_lag_ogg.sh

