【发布时间】:2017-12-13 18:52:06
【问题描述】:
我想使用 crontab 运行一个脚本来备份 PostgreSQL 数据库。
我的脚本如下所示:
#!/bin/bash
current_date=`date +%Y-%m-%d`
# Delete old backups
find /home/ubuntu/backups/ * -mtime +1 -delete
# Do a full postgres cluster
pg_dump dbname | gzip > /home/ubuntu/backups/$current_date.gz
文件的所有者是root,我可以更改它吗...
当使用 sudo 执行脚本时,我看到:
pg_dump: [archiver (db)] 连接到数据库“easydjango”失败:致命:角色“root”不存在
我该怎么做?
【问题讨论】:
标签: postgresql amazon-web-services amazon-ec2