Pete, you would be better off using the pkill command (if available) or
encapsulate your ps command with back ticks.
run "pkill -9 -f <search string of the argument portion of the process you
want to kill>"
or
run "kill -9 `<your ps command here>`"

otherwise you'll have to specify a block as described here
http://www.capify.org/index.php/Run catch the output save it as a variable
and then pass it to your subsequent run as

run "kill #{pid_variable}"

-Joe Wilcoxson

On Thu, Sep 17, 2009 at 2:28 PM, pete <[email protected]> wrote:

>
> Let me clarify this a little better...
>
> I would like to do something like this:
>
> task :myTask, :roles => :myhost do
>                run "ps- -aef | grep <searchstring> | head -2 | tail
> -1 | awk '{print $2}'"
>                run "kill <PID FROM PREVIOUS run COMMAND>"
> end
>
>
> On Sep 17, 11:57 am, pete <[email protected]> wrote:
> > Hi-
> >
> > I want to use Cap to kill a process, but I don't know the PID so I am
> > using what I have below to get it:
> >
> > ps- -aef | grep <searchstring> | head -2 | tail -1 | awk '{print $2}'
> >
> > Is it possible to use the results of the above command in a custom
> > task and kill off the PID that is returned?
> >
> > Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.co.uk/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to