BUG in 2.2.0 - cap deploy:stop with run_method sudo

10 views
Skip to first unread message

Jonathan Julian

unread,
Mar 21, 2008, 2:51:11 PM3/21/08
to Capistrano
*** [err :: myserver] sh: -c: line 0: syntax error near unexpected
token `then'
*** [err :: myserver] sh: -c: line 0: `sudo -p 'sudo password: ' -u
scott if [ -f /u/app/current/tmp/pids/dispatch.spawner.pid ]; then /u/
app/current/script/process/reaper -a kill -r dispatch.spawner.pid; fi'
command finished

The 'command' passed to sudo cannot be separated by semis. Solution:
make the command 'sh' and pass the real command in quotes.

The fix can be made in lib/capistrano/recipes/deploy.rb:429

invoke_command "sh -c 'if [ -f #{current_path}/tmp/pids/
dispatch.spawner.pid ]; then #{current_path}/script/process/reaper -a
kill -r dispatch.spawner.pid; fi'", :via => via, :as => as

matthooks

unread,
Mar 30, 2008, 4:01:02 PM3/30/08
to Capistrano
Thanks for the fix.

On Mar 21, 1:51 pm, Jonathan Julian <jonathan.m.jul...@gmail.com>
wrote:

Tim Carey-Smith

unread,
Apr 3, 2008, 1:08:55 AM4/3/08
to capis...@googlegroups.com
On 21/03/2008, at 2:51 PM, Jonathan Julian wrote:
> The fix can be made in lib/capistrano/recipes/deploy.rb:429

Should this be fixed in the main codebase?
I know I have had confusion with sudo "some_command;
some_other_command".

Maybe a ticket should be filed.

Tim

toddthomas

unread,
Apr 9, 2008, 8:11:22 PM4/9/08
to Capistrano
On Apr 2, 11:08 pm, Tim Carey-Smith <g...@spork.in> wrote:
> Should this be fixed in the main codebase?
[...]
> Maybe a ticket should be filed.

I am having this problem too. I did not see the fix in git, and I
don't see a ticket logged in lighthouse. Is this going to be fixed
some other way? Should I log a ticket?

matthooks

unread,
May 6, 2008, 6:38:57 PM5/6/08
to Capistrano
This is still present in 2.3. I fixed the bug by overloading the
"deploy:stop" task in my deploy.rb file:

namespace :deploy do
task :stop, :roles => :app do
# try_sudo "if [ -f #{current_path}/tmp/pids/
dispatch.spawner.pid ]; then #{current_path}/script/process/reaper -a
kill -r dispatch.spawner.pid; fi"
try_sudo "#{current_path}/script/process/reaper -a kill"
end
end

Jamis Buck

unread,
May 6, 2008, 10:08:18 PM5/6/08
to capis...@googlegroups.com
Can you refresh my memory? What is the bug that is manifesting?

- Jamis

Reply all
Reply to author
Forward
0 new messages