Small patch to fix bin/riak stop on OS X

Seth Falcon seth at userprimary.net
Sat Jul 3 15:52:58 EDT 2010


Hi all,

While going through the fast track, I noticed the following output
when stopping my local nodes via "dev?/bin/riak stop":

ps: illegal option -- f
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-u]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
ok

It seems that ps -f is not supported (indeed illegal!) on OS X.  The
following change works for me and I believe will work just as well on
Linux.

commit 82c6d30085ef38fcd97abc5e5293f9f4644f3092
Author: Seth Falcon <seth at userprimary.net>
Date:   Thu Jul 1 20:09:57 2010 -0700

    Fix ps command in riak stop for OS X

    OS X's ps command does not support -f, might as well
    pull out just the fields needed using -o

diff --git a/rel/files/riak b/rel/files/riak
index d425550..a4291fa 100755
--- a/rel/files/riak
+++ b/rel/files/riak
@@ -70,7 +70,7 @@ case "$1" in

     stop)
         # Wait for the node to completely stop...
-        PID=`ps -ef|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk '{print $2}'"`
+        PID=`ps -Ao pid,comm|grep "$RUNNER_BASE_DIR/.*/[b]eam.smp|awk
'{print $1}'"`
         $NODETOOL stop
         while `kill -0 $PID 2>/dev/null`;
         do


+ seth

I've also attempted to attach the patch in case whitespace is
destroyed via email.

-- 
Seth Falcon | @sfalcon | http://userprimary.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-ps-command-in-riak-stop-for-OS-X.patch
Type: application/octet-stream
Size: 848 bytes
Desc: not available
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20100703/e30f51ab/attachment.patch>


More information about the riak-users mailing list