export NLS_LANG="Simplified Chinese_china".AL32UTF8
export LANG=zh_CN.GB2312
export DATE=`date '+%Y%m%d'`
NOW=$(date +%Y%m%d)
mysql -uroot -p a123456 -Ne "select '注册时间,注册平台,注册数量,身份证数量,投资人数,投资金额'" > /tmp/$NOW.csv
mysql -uroot -pa123456 -Ne "select concat(reg_time,',',reg_platform,',',reg_count,',',id_card_count,',',invest_count,',',ifnull(inv
est_amount,0)) from warehe.dly_prmte order by reg_time DESC" >> /tmp/$NOW.csv
iconv -f UTF-8 -t GBK /tmp/$NOW.csv > /tmp/promote_$NOW.csv
remote_host=172.10.20.207
remote_user=yoni
remote_path=/storage/YunY/推广数据/
remote_pwd=aabbccdd
local_path=/tmp/
local_file=promote_$NOW.csv
expect -c "
set timeout 30
spawn scp ${local_path}${local_file} ${remote_user}@${remote_host}:${remote_path}
expect \"password:\"
send \"${remote_pwd}\r\"
expect eof
"
export LANG=zh_CN.GB2312
export DATE=`date '+%Y%m%d'`
NOW=$(date +%Y%m%d)
mysql -uroot -p a123456 -Ne "select '注册时间,注册平台,注册数量,身份证数量,投资人数,投资金额'" > /tmp/$NOW.csv
mysql -uroot -pa123456 -Ne "select concat(reg_time,',',reg_platform,',',reg_count,',',id_card_count,',',invest_count,',',ifnull(inv
est_amount,0)) from warehe.dly_prmte order by reg_time DESC" >> /tmp/$NOW.csv
iconv -f UTF-8 -t GBK /tmp/$NOW.csv > /tmp/promote_$NOW.csv
remote_host=172.10.20.207
remote_user=yoni
remote_path=/storage/YunY/推广数据/
remote_pwd=aabbccdd
local_path=/tmp/
local_file=promote_$NOW.csv
expect -c "
set timeout 30
spawn scp ${local_path}${local_file} ${remote_user}@${remote_host}:${remote_path}
expect \"password:\"
send \"${remote_pwd}\r\"
expect eof
"
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10569970/viewspace-1815706/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10569970/viewspace-1815706/