每日跑数脚本调用shell脚本
#!/bin/bash
run_date=`date -d "yesterday" +%Y-%m-%d`
# 检验有是否传递参数
if [ $# -eq 0 ]
then
echo 'please add at least one arg for specifing the process sql filepath!'
exit
fi
if [ $# -eq 2 -a -n "$2" ]
then
echo $2
run_date=$2
fi
echo $1, $run_date
username=root
password=123456
sed -i "1 i\SET @run_date='${run_date}';" $1
docker exec -i mysql mysql -u${username} -p${password} < $1
sed -i "1d" $1