|<- <- -> ->|

Processes

Monitor memory size of java processes once an hour.

Get a stack dump from processes whose size > 500M.

Problem: each thread of a java process has its own pid. Only kill -3 one of them.

[jao@zack]$ osh timer 1:00:00 ^ \
            f 'processes()' ^ \
            expand ^ \
            select 'p: \
                "java" in p.command_line() and \
                "java" not in p.parent().command_line() and \
                p.size() > 500000000 ^ \
            f 'p: p.kill(3)' $