Sudo命令有一些片deploy.rb的:重启Rails中4,Capistrano的
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
sudo "service nginx restart"
end
end
after :publishing, :restart
end
正如你所看到的,我想出版后重新启动我的Nginx服务器。但我收到以下错误:
cap aborted!
SSHKit::Command::Failed: sudo exit status: 1
sudo stdout: Nothing written
sudo stderr: sudo: no tty present and no askpass program specified
据我所知,我需要指定sudo命令的密码;但我没有在代码中存储密码,我使用SSH。我错了吗?我该如何解决它?提前致谢。
[Rails-Nginx需要用Capistrano部署后需要重新启动吗?]的可能重复(http://stackoverflow.com/questions/11939540/rails-nginx-needs-to-be-restarted-after-deploying-with -capistrano) –