Thursday 4 March 2010

Poor mans pgrep on Mac OS X

pgrep on [Open-]Solaris, Linux et al is very convenient. I was missing it on Mac OS X. In it's simplest form, emulate it by creating the following shell script somewhere in your path or alias it:

#!/bin/sh
ps -axo pid,command,args | grep -i "$@" | awk '{ print $1 }'

This yields the output you're used to:

foo:~$ pgrep postgres
2853
2856
2857
2858
2859
3057
3059

I like to see the full process args with that. A slight tweak:

#!/bin/sh
pids=`ps -axo pid,command,args | grep -i "$@" | awk '{ print $1 }' | tr '\n' ','`
ps -p $pids -o pid,args

Gives you:

foo:~$ pgrep postgres         
PID ARGS
2853 /opt/lib/postgresql84/bin/postgres -D /opt/var/db/postgresql84/d
2856 postgres: writer process                                        
2857 postgres: wal writer process                                    
2858 postgres: autovacuum launcher process                           
2859 postgres: stats collector process                               
3166 /bin/sh /Users/imfeldma/bin/pgrep postgres

Nothing stops you from replacing ps with kill to obtain a poor mans pkill. Enjoy.

UPDATE: Of course you may also install proctools via MacPorts or directly from Sourceforge: http://sourceforge.net/projects/proctools/

Monday 1 March 2010

ssh GSSAPI Authentication in Opensolaris zones

I got fairly confused when I was able to ssh successfully into the global zone with GSSAPI authentication but none of the non-global zones worked. The usual suspects (time, DNS, keytab) were all perfectly fine.

Finally I found that the standard zone install does not contain SUNWgssk and SUNWgssc, the kernel GSSAPI module and its configuration. (*sigh*).

# pkg install SUNWgssk SUNWgssc

and you're rolling. No need to svcadm restart ssh.

Tuesday 23 February 2010

Soziotechnische Massnahmen?

Soziotechnische Massnahmen is an (un-)word I've discovered somewhere in a large company I used to work for. Google translates it from German to English as Socio-technical measures. At first, I figured it was just a fancy way of saying people training but it turns out to be quite a science involving people and technology to be more efficient. Check out the Wikipedia article. It's actually quite interesting, but unfortunately often doomed in large companies unless people are motivated enough to actually pull it through.

While I have my own thoughts on this and might even blog about them at some point, this is not about socio-technical measures at all (sorry). I've primarily set up this blog to write about technical bits and pieces, which was my original understanding of the topic. I'm also moving to Asia in a couple of weeks so that should lighten up things.