123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/bin/bash
- year=
- while getopts ":y:m:" opt; do
- case $opt in
- y)
- year=$OPTARG
- ;;
- m)
- month=$OPTARG
- ;;
- ?)
- echo "usage: dumpdata -y=2019 -m=2"
- exit 1
- ;;
- esac
- done
- if [ ! -n "$year" ]; then
- echo "no year paramerter"
- exit 1
- fi
- if [ ! -n "$month" ]; then
- output="dump/${year}"
- else
- start_month=$(printf "%02d" ${month})
- start_year=${year}
- next_month=$(expr ${month} + 1)
- if [ $next_month -gt 12 ]; then
- end_month="01"
- end_year=$(expr ${year} + 1)
- else
- end_month=$(printf "%02d" ${next_month})
- end_year=${year}
- fi
- echo "$(pwd)/dump/${start_year}_${start_month}_01-${end_year}_${end_month}_01"
- output="$(pwd)/dump/${start_year}_${start_month}_01-${end_year}_${end_month}_01"
- fi
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c dealer_income_proxies --gzip ${output}/report/dealer_income_proxies.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c dealer_daily_stats --gzip ${output}/report/dealer_daily_stats.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c device_daily_stats --gzip ${output}/report/device_daily_stats.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c group_daily_stats --gzip ${output}/report/group_daily_stats.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c DealerReport --gzip ${output}/report/DealerReport.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c DevReport --gzip ${output}/report/DevReport.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d report_his -c GroupReport --gzip ${output}/report/GroupReport.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d washpay_his -c ConsumeRecord --gzip ${output}/washpay/ConsumeRecord.bson.gz --noIndexRestore
- mongorestore -h 172.16.145.62:20000 --authenticationDatabase=admin -u guanli -p 67374030857714990597992655453345 -d washpay_his -c RechargeRecord --gzip ${output}/washpay/RechargeRecord.bson.gz --noIndexRestore
|