123456789101112131415161718192021 |
- #!/bin/bash
- source /usr/local/greenplum-db-clients/greenplum_loaders_path.sh
- new_date=$1
- # 修改gpload配置文件
- sed -i 's/\/data1\/pm\/pm_4g\/distinct\/pm_4g_hour_[0-9]\{10\}.csv/\/data1\/pm\/distinct\/pm_4g_hour_'${new_date}'.csv/' /data1/pm/pm_4g/pm_lte_gpload2.yml
- # 由于gpload需要输入密码,这里需要使用expect执行
- password=sqmdb_1QAZ
- expect -c "
- set timeout 300
- spawn gpload -f /data1/pm/pm_4g/pm_lte_gpload2.yml
- expect {
- \"connecting (yes/no)?\" { send \"yes\n\";exp_continue }
- \"Password:\" { send \"${password}\n\"; exp_continue}
- timeout { puts \"超时\" exit 2}
- }
- "
|