我試着讓自動備份腳本運行。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。
問候
馬丁