pm_lte_gpload.sh 596 B

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