关闭

Linux shell function call Sample

标签: shell函数linux shell
329人阅读 评论(0) 收藏 举报
分类:


[hs@master Log_Data]$ cat dw_parameter_ex.sh

#!/bin/bash
#99_dianz total data proc ...
src_dbip=`sh /home/hs/opt/public-function/getsrcinfo.fc dbip 99_dianz`
src_user=`sh /home/hs/opt/public-function/getsrcinfo.fc user 99_dianz`
src_pass=`sh /home/hs/opt/public-function/getsrcinfo.fc pass 99_dianz`

dw_dbip=`sh /home/hs/opt/public-function/getdwinfo.fc dbip sor`
dw_user=`sh /home/hs/opt/public-function/getdwinfo.fc user sor`
dw_pass=`sh /home/hs/opt/public-function/getdwinfo.fc pass sor`

/usr/local/bin/mysql -h$src_dbip -u$src_user -p$src_pass -N -e"select CONCAT(ifnull(\`dianz_id\`,''),'|',ifnull(\`status\`,''),'|',ifnull(\`role\`,''),'|',ifnull(\`sid\`,''),'|',ifnull(\`uid\`,''),'|',ifnull(replace(replace(replace(\`name\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`gender\`,''),'|',ifnull(\`package_id\`,''),'|',ifnull(replace(replace(replace(\`phone\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`email\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`delivery_address\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`jd_address1\`,''),'|',ifnull(\`jd_address2\`,''),'|',ifnull(\`jd_address3\`,''),'|',ifnull(\`jd_address4\`,''),'|',ifnull(replace(replace(replace(\`jd_address_detail\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`jd_address_full\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`zip_code\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`site_id\`,''),'|',ifnull(\`dianzentry_id\`,''),'|',ifnull(\`floor\`,''),'|',ifnull(replace(replace(replace(\`ali_account\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`ali_name\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`is_pass\`,''),'|',ifnull(from_unixtime(\`add_time\`,'%Y-%m-%d %H:%i:%s'),''),'|',ifnull(\`is_new\`,''),'|',ifnull(\`money\`,''),'|',ifnull(\`overdraft\`,''),'|',ifnull(\`parent_staff_id\`,''),'|',ifnull(\`dhid\`,''),'|',ifnull(replace(replace(replace(\`notice\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`drink_notice\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`portrait\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`verified_status\`,''),'|',ifnull(\`print_verified_status\`,''),'|',ifnull(from_unixtime(\`verified_time\`,'%Y-%m-%d %H:%i:%s'),''),'|',ifnull(from_unixtime(\`print_verified_time\`,'%Y-%m-%d %H:%i:%s'),''),'|',ifnull(\`mobile_check\`,''),'|',ifnull(\`freeze_money\`,''),'|',ifnull(\`freeze_type\`,''),'|',ifnull(\`check_status\`,''),'|',ifnull(\`permit_box\`,''),'|',ifnull(replace(replace(replace(\`bank_id\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`open_location\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`open_account\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(replace(replace(replace(\`card_number\`,char(13),''),char(10),''),'|',''),''),'|',ifnull(\`timeline\`,'')) from db99huanxiao.99_dianz;" >/home/hs/opt/dw-etl/rds_qrt/real_data_dir/db99huanxiao.99_dianz_rt.dat

#real_99_dianz table data download from src and upload to qrt rds...
/usr/local/bin/mysql -h$dw_dbip -u$dw_user -p$dw_pass -e "use qrt;truncate table real_99_dianz;"
#loop load dir file to rds 
/usr/local/bin/mysql -h$dw_dbip -u$dw_user -p$dw_pass -e "use qrt;load data local infile '/home/hs/opt/dw-etl/rds_qrt/real_data_dir/db99huanxiao.99_dianz_rt.dat' into table real_99_dianz fields terminated by '|' enclosed by '' lines terminated by '\n' ignore 0 lines;"

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:241478次
    • 积分:3816
    • 等级:
    • 排名:第8895名
    • 原创:194篇
    • 转载:3篇
    • 译文:0篇
    • 评论:21条
    文章分类
    最新评论