Actually I don't think pgrep will work for this reliably - here's what I
get:

    root@solr-berkshelf:~# pgrep jetty
    root@solr-berkshelf:~# echo $?
    1
    root@solr-berkshelf:~# ps aux | grep -w jetty | grep -qv grep
    root@solr-berkshelf:~# echo $?
    0
    root@solr-berkshelf:~# ps aux | grep -w jetty | grep -v grep
    jetty    12169  0.4 23.3 1543184 87252 ?       Sl   Apr03   1:12
/usr/bin/java -Dsolr.solr.home=/opt/solr -Djetty.port=8085
-Djetty.home=/opt/jetty -Djava.io.tmpdir=/tmp -jar /opt/jetty/start.jar
--pre=etc/jetty-logging.xml --daemon

Doing it this way is one way to check and see if a process is there -
that's not a usual process - pgrep works great with things like ssh:

    root@solr-berkshelf:~# pgrep sshd
    1211
    11206
    11226

I suppose we could use grep with [j]etty - that would work too.



On Wed, Apr 3, 2013 at 4:25 PM, Raphaël Pinson <notifications@github.com>wrote:

> In lib/serverspec/commands/base.rb:
>
> > @@ -36,7 +36,7 @@ def check_running service
> >        end
> >
> >        def check_process process
> > -        "ps aux | grep -qw #{process}"
> > +        "ps aux | grep -w #{process} | grep -qv grep"
>
> http://www.math.utah.edu/~beebe/unix/p/pgrep.html shows the support for
> it. Maybe it could be used when available, although that's not easy since
> all commands are launched through SSH.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mizzy/serverspec/pull/33/files#r3646446>
> .
>