sleep 3
# Insert Result to DB
id=$(date +%s%3N)
ip_server=$( /sbin/ifconfig | grep 'inet addr:' | grep Bcast | cut -d":" -f2 | awk '{print $1}')
time_run=$(date +"%F %H:%M:%S")
path_run="`pwd`/$0"
detail="Xuat bao cao cho Sacombank luc 5h5 sang"
result=`cat /app/mservice/bank/report/sacombank_report_new/log/$today.log | grep -E 'File Created|\[SendSFTP\] \-\-\- DONE' | wc -l`
if [[ $result -eq 2 ]]
then
result='ok'
else
result='notok'
fi
note=$(cat /app/mservice/bank/report/sacombank_report_new/log/$today.log | grep -o -E 'Transactions All.*|File Uploaded' | tr '\n' ' ' | cut -d" " -f6,9)
# Call file script with Insert DB Function
source /app/mservice/Insert_DB_Oracle.sh
exit
#Insert to DB by bash shell
#!/bin/bash
export LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
userdb='operator_xxxx'
passdb='xxxxxxxxx'
ipdb='ltest-scan.xxxxx.com.vn'
nsdb='ltest.xxxxx.com.vn'
IFS=$'\n' # make newlines the only separator
for line in $(cat /vanhanh/phongbankhac/Ketoan/lower_limit_adjust/text.txt | sed '/^$/d')
do
ctime=$(date +%s%3N)
#ctime=`echo $line | awk '{print $1}'`
tid=`echo $line | awk '{print $2}'`
number_phone=`echo $line | awk '{print $3}'`
date_time=$(date +"%F %H:%M:%S")
#date_time=`echo $line | awk '{print $4}'`
wallet_type=`echo $line | awk '{print $5}'`
amount=`echo $line | awk '{print $6}'`
reason=`echo $line | awk '{print $7}'`
echo $ctime $tid $number_phone $date_time $wallet_type $amount $reason
sqlplus -s "$userdb"/"$passdb"@"$ipdb"/"$nsdb" <<-EOF
INSERT INTO VH_LOWERLIMIT VALUES ('$ctime', '$tid','$number_phone', TO_DATE('$date_time', 'yyyy/mm/dd hh24:mi:ss' ), '$wallet_type', '$amount', '$reason');
commit
quit
EOF
sleep 1
done
Không có nhận xét nào:
Đăng nhận xét