#!/bin/tcsh
set I=0
set pid = $1
while (-e /proc/$pid/status)
    set J=`cat /proc/$pid/stat | awk '{print $23}'`
    if($J >= $I) then
        set I=$J
    endif
    sleep 1
end
rm -rf $2
echo $I > $2
