我尝试运行自动备份脚本。
如果我通过在终端中键入“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!
定时日志:
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 用户,他还要求输入密码......但是一个空的会停止脚本)
有人对我有线索吗?正如我所说,它可以完美地手动运行,bot 不支持 cron。
问候
马丁