Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capistrano 3 Sudo Password Hangs

I have the following capistrano 3 task:

desc 'Add root scheduled tasks'
task :root_schedules do
  on roles(:all) do 
    within release_path do
      execute :sudo, :bundle, 'exec whenever -w config/root_schedule.rb -u root'
    end
  end
end

I need this task to run with sudo privileges because I need the scheduled tasks to run with higher privileges. These are backend scheduled server tasks. Problem is that everytime I run this command I get following:

DEBUG [46d3800c]    [sudo] password for [user]

After I type my password and hit enter, it never completes anything. No response at all. Any answers out there?

like image 638
zquintana Avatar asked Feb 19 '15 04:02

zquintana


1 Answers

I just created a gem for this purpose: sshkit-sudo

  1. Add gem 'sshkit-sudo' to Gemfile
  2. Add require 'sshkit/sudo' to Capfile

Now you can use sudo command in your Capistrano 3 task.

like image 192
Kentaro Imai Avatar answered Sep 24 '22 15:09

Kentaro Imai