Small patch to fix bin/riak stop on OS X

Andrew Tunnell-Jones andrew at tj.id.au
Sat Jul 3 20:52:26 EDT 2010


Hi Seth,

That option is supported by OS X however it is only enabled if COMMAND_MODE is set as unix2003. This is set by default in Apple's Terminal application but not in iTerm:

Last login: Sun Jul  4 00:40:36 on ttys002
~
$ ps -f
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]
~
$ env COMMAND_MODE=unix2003 ps -f
  UID   PID  PPID   C     STIME TTY           TIME CMD
  501   753   751   0   0:00.07 ttys000    0:00.13 -bash
  501  1161  1160   0   0:00.04 ttys001    0:00.08 -bash
  501  1311  1310   0   0:00.03 ttys002    0:00.07 -bash


— Andrew
http://andrew.tj.id.au/


On 04/07/2010, at 5:52 AM, Seth Falcon wrote:

> 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/
> <0001-Fix-ps-command-in-riak-stop-for-OS-X.patch>_______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list