Home >Database >Mysql Tutorial >shell脚本调用mysql存储过程_MySQL

shell脚本调用mysql存储过程_MySQL

WBOY
WBOYOriginal
2016-06-01 13:18:531984browse

bitsCN.com

#!/bin/sh##  The function of the script is used to balance statistics,we get##  data from the table accseqs,after the analysis and calculation data,##  the results will be inserted into the table acc_balances.##  the script is executed at 1 o'clock by every day.DIR="/var/www/apps/sql"DATE=$(date +%Y%m%d --date '1 days ago')HOST=192.168.20.95USER=adminPASSWD=000000DATABASE=zhxtFILE=result.txtcd ${DIR}echo "the date:"${DATE}SQL="exec mysql -h${HOST} -u${USER} -p${PASSWD} -D ${DATABASE} --default-character-set=utf8 -e /"call query_balance(${DATE})/""echo ${SQL}>>${FILE}if   mysql -h${HOST} /           -u${USER} /           -p${PASSWD} /           -D ${DATABASE} /           --default-character-set=utf8 /           -e "call query_balance(${DATE})"; then    echo "ok">>${FILE}else    echo "fail">>${FILE}fiexit


bitsCN.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn