Ruby on rails Rails-gem-cron-fe_-sendauth:未提供密码
我运行的Rails服务器定期运行Ruby on rails Rails-gem-cron-fe_-sendauth:未提供密码,ruby-on-rails,ruby,cron,whenever,Ruby On Rails,Ruby,Cron,Whenever,我运行的Rails服务器定期运行rake任务,使用gem和cron 我可以使用这些工具成功地运行rake任务。在我的远程服务器上,我以root用户身份运行它。第二次尝试也有效 RAILS_ENV=production rake fetch_myitems // attempt 1 //attempt 2 /bin/bash -l -c 'cd /home/rails/AniKawaii && RAILS_ENV=production bun
rake任务
,使用gem和cron
我可以使用这些工具成功地运行rake任务
。在我的远程服务器上,我以root用户身份运行它。第二次尝试也有效
RAILS_ENV=production rake fetch_myitems
// attempt 1
//attempt 2
/bin/bash -l -c 'cd /home/rails/AniKawaii && RAILS_ENV=production bundle exec rake fetch_animegifs --silent >> log/whenever.log 2>&1'
调试后,这就是我最终的错误源。我知道这与database.yml有关。但是,我可以成功地部署到我的实时生产服务器,并且调用RAILS\u ENV=production rake fetch\u myitems
不会触发此错误,因此我不知道该怎么做
PG::ConnectionBad: fe_sendauth: no password supplied
Crontab-l
由于某种原因,在
/etc/default/unicorn文件中
即使我将nginx与unicorn一起重新加载,应用程序数据库密码
也不会更新
我的修复方法是手动覆盖database.yml中的密码。出于某种原因,在
/etc/default/unicorn文件中即使我将nginx与unicorn一起重新加载,应用程序数据库密码也不会得到更新
我的修复方法是手动覆盖database.yml中的密码。我猜您的database.yml文件类似于:
production:
adapter: postgresql
encoding: unicode
database: test-postgres_production
pool: 5
username: rails
password: <%= ENV['PGPASS'] %>
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/rails/AniKawaii && RAILS_ENV=production PGPASS=your_database_password_here bundle exec rake fetch_animegifs --silent >> log/whenever.log 2>&1'
希望这能帮你分类。我猜你的database.yml文件看起来像:
production:
adapter: postgresql
encoding: unicode
database: test-postgres_production
pool: 5
username: rails
password: <%= ENV['PGPASS'] %>
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /bin/bash -l -c 'cd /home/rails/AniKawaii && RAILS_ENV=production PGPASS=your_database_password_here bundle exec rake fetch_animegifs --silent >> log/whenever.log 2>&1'
希望这能给您带来好处。即使这样做可行,但使用pass-in cron安全吗?cron仍然比将其放在存储库中更安全即使这样做可行,使用pass-in cron安全吗?cron仍然比将其放在存储库中更安全