我试着让自动备份脚本运行。Ubuntu上的Postgres备份脚本+ cron
如果我通过在终端中键入“bash backup.su”来运行脚本,该脚本完美地工作。 对于每个查询和操作,我必须输入密码(数据库用户),但它工作正常。
但是,只要我不使用终端(例如通过cron),它不会。它只是打印出我的日志文件没有任何信息。
我认为这是与用户权限
端子输出:
Making backup directory in /scripts/2013-09-26-daily
Performing schema-only backups
------------------------------------------
Password for user backupuser: <- Query getting all databases with certain string in name
The following databases were matched for schema-only backup:
Performing full backups
------------------------------------------
Password for user backupuser: <- Query getting all databases
Plain backup of DB1
Password:
Plain backup of DB2
Password:
Plain backup of AndSoOn
Password:
All database backups complete!
的Cron日志:
Making backup directory in /scripts/2013-09-26-daily/
Performing schema-only backups
------------------------------------------
The following databases were matched for schema-only backup:
Performing full backups
------------------------------------------
All database backups complete!
正如你可以看到有似乎没有查询执行。现在我正在使用一个特殊的备份用户,但它也不适用于postgres。 (有了postgres用户,他还要求输入密码......但是空的一个会停止脚本)
有没有人对我有任何线索?正如我所说,它完全手动工作,机器人不与cron。
问候
马丁