Reputation: 53
I want to run my Httpd service to restart by Capistano, so I write this code for that
namespace :deploy do
task :restart do
on roles(:app), in: :sequence, wait: 1 do
within current_path do
execute "service httpd restart"
end
end
end
end
after :deploy, 'deploy:restart'
but when it cap file execute this line it is asking for the user's password, but I need to run this command with root user.
Please let me know how to execute this command with root user.
Upvotes: 1
Views: 1290
Reputation: 2653
The Capistrano documentation recommends adding this particular command to passwordless-sudo:
Then you can call sudo without being prompted for a password.
Upvotes: 0
Reputation: 682
better try with sudoer user, than adding it to code for prompt.
Upvotes: 1