backup-db.sh 472 B

1234567891011121314
  1. #!/bin/sh
  2. echo "$(date) backup start"
  3. export PGPASSWORD='gC5jP3oM1tQ8'
  4. backup_dir=/data/ts_acl_backup/$(date +%Y%m%d%H%M%S)
  5. mkdir -p "${backup_dir}"
  6. host='192.168.70.136'
  7. port='9999'
  8. username='ts_acl'
  9. dbname='ts_acl'
  10. jobs='24'
  11. echo "pg_dump -h ${host} -p ${port} -U ${username} -d ${dbname} -v -O -Fd -j ${jobs} -Z9 -f ${backup_dir}"
  12. pg_dump -h "${host}" -p "${port}" -U "${username}" -d "${dbname}" -v -O -Fd -j "${jobs}" -Z9 -f "${backup_dir}"
  13. echo "$(date) backup end"