- #!/bin/sh
- echo "$(date) backup financialdb start"
- export PGPASSWORD='Finance@unicom23'
- backup_dir=/backup/postgres/financialdb/$(date +%Y%m)/$(date +%Y%m%d)/$(date +%Y%m%d%H%M%S)
- mkdir -p "${backup_dir}"
- host='172.16.107.5'
- port='5432'
- username='finance'
- dbname='financialdb'
- jobs='16'
- echo "pg_dump -h ${host} -p ${port} -U ${username} -d ${dbname} -v -O -Fd -j ${jobs} -Z9 -f ${backup_dir}"
- pg_dump -h "${host}" -p "${port}" -U "${username}" -d "${dbname}" -v -O -Fd -j "${jobs}" -Z9 -f "${backup_dir}"
- echo "$(date) backup financialdb end"
|