我有一个用于备份postgresql数据库的脚本
#!/bin/bash
# Location to place backups.
backup_dir="/path/to/backups/"
#String to append to the name of the backup files
backup_date=`date +%Y-%m-%d`
#Numbers of days you want to keep copie of your databases
number_of_days=7
databases=`psql -l -t | cut -d'|'